当前位置: 首页>>代码示例>>PHP>>正文


PHP Response::getReasonPhrase方法代码示例

本文整理汇总了PHP中Buzz\Message\Response::getReasonPhrase方法的典型用法代码示例。如果您正苦于以下问题:PHP Response::getReasonPhrase方法的具体用法?PHP Response::getReasonPhrase怎么用?PHP Response::getReasonPhrase使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Buzz\Message\Response的用法示例。


在下文中一共展示了Response::getReasonPhrase方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testGetReasonPhraseReturnsAMultiwordReasonPhrase

 public function testGetReasonPhraseReturnsAMultiwordReasonPhrase()
 {
     $response = new Response();
     $this->assertNull($response->getReasonPhrase());
     $response->addHeader('HTTP/1.0 500 Internal Server Error');
     $this->assertEquals('Internal Server Error', $response->getReasonPhrase());
 }
开发者ID:ChazalFlorian,项目名称:enjoyPangolin,代码行数:7,代码来源:ResponseTest.php

示例2: processResponse

 private function processResponse(Response $response)
 {
     $this->logger->info('Response:' . $response);
     if (500 <= $response->getStatusCode()) {
         throw new ApiServerException($response->getStatusCode(), $response->getContent(), $response->getReasonPhrase(), $response->getHeaders());
     }
     if (400 <= $response->getStatusCode()) {
         try {
             $error = $this->parser->parse($response->getContent());
             $error = $error instanceof Model\Error ? $error : new Model\Error();
         } catch (ApiParserException $e) {
             throw new ApiClientException($response->getStatusCode(), $response->getContent(), $response->getReasonPhrase(), $response->getHeaders(), null, $e);
         }
         throw new ApiClientException($response->getStatusCode(), $response->getContent(), $response->getReasonPhrase(), $response->getHeaders(), $error);
     }
     if (204 === $response->getStatusCode()) {
         return true;
     }
     $content = trim($response->getContent());
     if (empty($content)) {
         return true;
     }
     $object = $this->parser->parse($content);
     $object->setApi($this);
     return $object;
 }
开发者ID:KinaMarie,项目名称:connect,代码行数:26,代码来源:Api.php

示例3: __construct

 /**
  * @param string|null $message
  */
 public function __construct(RequestInterface $request, Response $response, $message = null)
 {
     $this->request = $request;
     $this->response = $response;
     if ($message === null) {
         $curlError = $response->getHeader('X-Curl-Error-Result');
         $message = sprintf('HTTP %s request to "%s%s" failed: %d - "%s".', $request->getMethod(), $request->getHost(), $request->getResource(), $curlError ?: $response->getStatusCode(), $curlError ? curl_strerror($curlError) : $response->getReasonPhrase());
     }
     parent::__construct($message);
 }
开发者ID:vaniocz,项目名称:VanioBuzzBundle,代码行数:13,代码来源:RequestFailedException.php

示例4: processResponse

 private function processResponse(Response $response)
 {
     if (null !== $this->logger) {
         $this->logger->info(sprintf('Status Code %s', $response->getStatusCode()));
         $this->logger->debug(var_export($response->getContent(), true));
     }
     if (500 <= $response->getStatusCode()) {
         throw new ApiServerException($response->getStatusCode(), $response->getContent(), $response->getReasonPhrase(), $response->getHeaders());
     }
     if (400 <= $response->getStatusCode()) {
         throw new ApiClientException($response->getStatusCode(), $response->getContent(), $response->getReasonPhrase(), $response->getHeaders());
     }
     if (204 === $response->getStatusCode()) {
         return true;
     }
     if (null !== $response->getContent()) {
         $object = $this->parser->parse($response->getContent());
         $object->setApi($this);
         return $object;
     }
 }
开发者ID:nfabre,项目名称:connect,代码行数:21,代码来源:Api.php

示例5: factory

 /**
  * @param Request $request
  * @param Response $response
  * 
  * @return HttpException
  */
 public static function factory(Request $request, Response $response)
 {
     if ($response->isClientError()) {
         $label = 'Client error response';
     } elseif ($response->isServerError()) {
         $label = 'Server error response';
     } else {
         $label = 'Unsuccessful response';
     }
     $message = implode(PHP_EOL, array($label, '[status code] ' . $response->getStatusCode(), '[reason phrase] ' . $response->getReasonPhrase(), '[url] ' . $request->getUrl()));
     $e = new static($message, $response->getStatusCode());
     $e->setResponse($response);
     $e->setRequest($request);
     return $e;
 }
开发者ID:Studio-40,项目名称:Payum,代码行数:21,代码来源:HttpException.php

示例6: __construct

 public function __construct(Response $response)
 {
     $message = 'Request was unable to reach the API, transport error "%s"';
     parent::__construct(sprintf($message, $response->getReasonPhrase()), $response->getStatusCode());
 }
开发者ID:markey-magic,项目名称:tractionphp,代码行数:5,代码来源:TransportException.php

示例7: getResponseStatusMessage

 public function getResponseStatusMessage()
 {
     return $this->response->getReasonPhrase();
 }
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:4,代码来源:BuzzClient.php


注:本文中的Buzz\Message\Response::getReasonPhrase方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。