Esempio n. 1
0
 /**
  * {@inheritdoc}
  */
 public function addCall($methodName, array $params = [], callable $onSuccess = null, callable $onError = null)
 {
     if (!is_string($methodName)) {
         throw Exception\InvalidArgumentException::expectedParameter(1, 'string', $methodName);
     }
     $this->calls[$this->index] = compact('methodName', 'params');
     $this->handlers[$this->index] = compact('onSuccess', 'onError');
     ++$this->index;
     return $this;
 }
Esempio n. 2
0
 /**
  * {@inheritdoc}
  */
 public function call($methodName, array $params = [])
 {
     if (!is_string($methodName)) {
         throw Exception\InvalidArgumentException::expectedParameter(0, 'string', $methodName);
     }
     $params = array_merge($this->prependParams, $params, $this->appendParams);
     $payload = $this->serializer->serialize($methodName, $params);
     $response = $this->transport->send($this->uri, $payload);
     $result = $this->parser->parse($response, $isFault);
     if ($isFault) {
         throw FaultException::createFromResponse($result);
     }
     return $result;
 }