Ejemplo n.º 1
0
 /**
  * @param string $name
  * @param array $arguments
  *
  * @return array
  * @throws BadResponseException
  * @throws \Exception
  */
 public function __call($name, array $arguments)
 {
     try {
         $response = parent::__call($name, $arguments);
         return json_decode($response['additionalProperties'], true);
     } catch (\Exception $ex) {
         throw $ex;
     }
 }
Ejemplo n.º 2
0
 public function __call($name, array $arguments)
 {
     if (in_array($name, $this->executeWithBody)) {
         return $this->executeRequestWithBody($name, $arguments[0]);
     }
     return parent::__call($name, $arguments);
 }
Ejemplo n.º 3
0
 /**
  * @param string $name
  * @param array $arguments
  *
  * @return array
  * @throws BadResponseStatusException
  * @throws \Exception
  */
 public function __call($name, array $arguments)
 {
     $response = parent::__call($name, $arguments);
     /** @var Stream $stream */
     $stream = $response['additionalProperties'];
     $data = json_decode($stream->getContents(), true);
     if ($data['status'] !== 'ok') {
         throw new BadResponseStatusException($data['status'], $data['description']);
     } else {
         return $data;
     }
 }
Ejemplo n.º 4
0
 public function __call($name, array $arguments)
 {
     try {
         return parent::__call($name, $arguments);
     } catch (\Exception $e) {
         $this->handleHttpError($e);
     }
     return false;
 }
 /**
  * @param string $method
  * @param array $args
  * @return mixed
  */
 public function __call($method, array $args)
 {
     if (isset($args[0]) && $args[0] instanceof DefinitionInterface) {
         /** @var DefinitionInterface $definition */
         $definition = $args[0];
         $args[0] = $definition->toArray();
     }
     // It seems we can't intercept Guzzle's request exceptions through the event system...
     // e.g. when http://api.blitline.com/ is unreachable or the request times out.
     try {
         return parent::__call($method, $args);
     } catch (\Exception $e) {
         throw Exception\OperationException::wrapException($e);
     }
 }
Ejemplo n.º 6
0
 /**
  * @param string $method
  * @param array $args
  * @return mixed
  */
 public function __call($method, array $args)
 {
     // It seems we can't intercept Guzzle's request exceptions through the event system...
     // e.g. when the endpoint is unreachable or the request times out.
     try {
         return parent::__call($method, $args);
     } catch (\Exception $e) {
         throw Exception\OperationException::wrapException($e);
     }
 }