示例#1
0
 /**
  * @param Response $response
  * @param int $message
  * @param int $code
  * @param $previous
  */
 public function __construct(Response $response, $message, $code, $previous)
 {
     parent::__construct($message, $code, $previous);
     $this->response = $response;
 }
 public function __construct(Response $response)
 {
     parent::__construct('Forbidden', $response);
 }
 public function __construct()
 {
     $message = 'HTTP Version Not Supported';
     parent::__construct(505, $message);
 }
 function __construct($resource, $method)
 {
     parent::__construct('Access resource(' . $resource . ') with method(' . $method . ') unauthorized', 401);
 }
 /**
  * @param string $resource
  * @param string $message
  */
 public function __construct($resource = null, $message = null)
 {
     parent::__construct(isset($message) ? $message : self::composeMessage($resource));
 }
 function __construct($params)
 {
     parent::__construct(self::ERROR_MESSAGE, self::ERROR_DESCRIPTION, self::ERROR_CODE);
     $this->setParams($params);
 }
 /**
  * ValidationException constructor.
  *
  * @param int   $status
  * @param mixed $errors
  */
 public function __construct($status, $errors, array $lastOptions = [])
 {
     parent::__construct($status, $errors, $lastOptions);
     $this->message = "Erros de validação foram encontrados!";
 }
示例#8
0
 /**
  * Constructor.
  *
  * @param string          $methodRef The fullname of called API method
  * @param string          $message   The message
  * @param int             $code      The number of code exception
  * @param \Exception|null $previous  The previous exception
  * @param string          $requestId The request identifier
  */
 public function __construct($methodRef, $message, $code = 0, \Exception $previous = null, $requestId = null)
 {
     parent::__construct($message, (int) $code, $previous);
     $this->methodRef = $methodRef;
     $this->requestId = $requestId;
 }
 public function __construct(Response $response)
 {
     parent::__construct('Not Found', $response);
 }
 public function __construct(Response $response)
 {
     parent::__construct('Internal Error Exception', $response);
 }
示例#11
0
 /**
  * @inheritdoc
  */
 public function __construct($message = null, \Exception $previous = null, $code = null)
 {
     isset($message) || ($message = 'Cannot provide response in the specified format.');
     parent::__construct($message, $code, $previous);
 }
 function __construct($resource)
 {
     parent::__construct('Resource (' . $resource . ') not found', 404);
 }
 public function __construct(Response $response)
 {
     parent::__construct('Too Many Requests', $response);
 }
 public function __construct(Response $response)
 {
     parent::__construct('Service Unavailable', $response);
 }
 public function __construct()
 {
     $message = 'Request URI Too Long';
     parent::__construct(414, $message);
 }
 public function __construct($resouce, $controller)
 {
     parent::__construct('The resource (' . $resouce . ') is broken (' . get_class($controller) . ')', 501);
 }
示例#17
0
 public function __construct()
 {
     $message = 'Bad Request';
     parent::__construct(400, $message);
 }
 public function __construct()
 {
     $message = 'Request Entity Too Large';
     parent::__construct(413, $message);
 }
 /**
  * @param int $status_code
  */
 public function __construct($status_code)
 {
     parent::__construct(array('error' => array('message' => 'Empty Response')), $status_code);
 }
 public function __construct(Response $response)
 {
     parent::__construct('Method Not Allowed', $response);
 }
 public function __construct($message = '', $code = 404, \Exception $previous = null)
 {
     parent::__construct($message, $code, $previous);
 }
 public function __construct(Response $response)
 {
     parent::__construct('Bad Request', $response);
 }
示例#23
0
文件: API.php 项目: m6w6/seekat
 /**
  * Import handler for the endpoint's underlying data
  *
  * \seekat\Call will call this when the request will have finished.
  *
  * @param Response $response
  * @return API self
  * @throws UnexpectedValueException
  * @throws RequestException
  * @throws \Exception
  */
 function import(Response $response) : API
 {
     $this->__log->info(__FUNCTION__ . ": " . $response->getInfo(), ["url" => (string) $this->__url]);
     if ($response->getResponseCode() >= 400) {
         $e = new RequestException($response);
         $this->__log->critical(__FUNCTION__ . ": " . $e->getMessage(), ["url" => (string) $this->__url]);
         throw $e;
     }
     if (!($type = $response->getHeader("Content-Type", Header::class))) {
         $e = new RequestException($response);
         $this->__log->error(__FUNCTION__ . ": Empty Content-Type -> " . $e->getMessage(), ["url" => (string) $this->__url]);
         throw $e;
     }
     try {
         $this->__type = new ContentType($type);
         $this->__data = $this->__type->parseBody($response->getBody());
         if ($link = $response->getHeader("Link", Header::class)) {
             $this->__links = new Links($link);
         }
     } catch (\Exception $e) {
         $this->__log->error(__FUNCTION__ . ": " . $e->getMessage(), ["url" => (string) $this->__url]);
         throw $e;
     }
     return $this;
 }