1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-10 08:52:39 +01:00

Throw on invalid Conduit method parameters

Summary: NOTE: This may break stuff.

Test Plan:
  $ echo '{}' | arc call-conduit conduit.ping
  $ echo '{"x": 1}' | arc call-conduit conduit.ping

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D4191
This commit is contained in:
vrana 2012-12-14 17:08:43 -08:00
parent a0e93fd4c4
commit 94d42b6313

View file

@ -11,14 +11,22 @@
final class ConduitCall {
private $method;
private $params;
private $request;
private $user;
public function __construct($method, array $params) {
$this->method = $method;
$this->params = $params;
$this->handler = $this->buildMethodHandler($method);
$invalid_params = array_diff_key(
$params,
$this->handler->defineParamTypes());
if ($invalid_params) {
throw new ConduitException(
"Method '{$method}' doesn't define these parameters: '" .
implode("', '", array_keys($invalid_params)) . "'.");
}
$this->request = new ConduitAPIRequest($params);
}