Changeset View
Changeset View
Standalone View
Standalone View
src/applications/conduit/call/ConduitCall.php
Show All 9 Lines | |||||
*/ | */ | ||||
final class ConduitCall extends Phobject { | final class ConduitCall extends Phobject { | ||||
private $method; | private $method; | ||||
private $handler; | private $handler; | ||||
private $request; | private $request; | ||||
private $user; | private $user; | ||||
public function __construct($method, array $params) { | public function __construct($method, array $params, $strictly_typed = true) { | ||||
$this->method = $method; | $this->method = $method; | ||||
$this->handler = $this->buildMethodHandler($method); | $this->handler = $this->buildMethodHandler($method); | ||||
$param_types = $this->handler->getParamTypes(); | $param_types = $this->handler->getParamTypes(); | ||||
foreach ($param_types as $key => $spec) { | foreach ($param_types as $key => $spec) { | ||||
if (ConduitAPIMethod::getParameterMetadataKey($key) !== null) { | if (ConduitAPIMethod::getParameterMetadataKey($key) !== null) { | ||||
throw new ConduitException( | throw new ConduitException( | ||||
Show All 9 Lines | public function __construct($method, array $params, $strictly_typed = true) { | ||||
if ($invalid_params) { | if ($invalid_params) { | ||||
throw new ConduitException( | throw new ConduitException( | ||||
pht( | pht( | ||||
'API Method "%s" does not define these parameters: %s.', | 'API Method "%s" does not define these parameters: %s.', | ||||
$method, | $method, | ||||
"'".implode("', '", array_keys($invalid_params))."'")); | "'".implode("', '", array_keys($invalid_params))."'")); | ||||
} | } | ||||
$this->request = new ConduitAPIRequest($params); | $this->request = new ConduitAPIRequest($params, $strictly_typed); | ||||
} | } | ||||
public function getAPIRequest() { | public function getAPIRequest() { | ||||
return $this->request; | return $this->request; | ||||
} | } | ||||
public function setUser(PhabricatorUser $user) { | public function setUser(PhabricatorUser $user) { | ||||
$this->user = $user; | $this->user = $user; | ||||
▲ Show 20 Lines • Show All 103 Lines • Show Last 20 Lines |