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


PHP Response::getMessage方法代码示例

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


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

示例1: getResponse

 /**
  * Get the response of the query.
  * Will be the json decoded data if success, else the error message.
  *
  * @return array|string
  */
 public function getResponse()
 {
     if (false === $this->response->isSuccessful()) {
         return $this->response->getMessage();
     }
     return $this->response->json();
 }
开发者ID:pompdelux,项目名称:kraken-bundle,代码行数:13,代码来源:KrakenResponse.php

示例2: getMessage

 /**
  * {@inheritdoc}
  */
 public function getMessage()
 {
     try {
         $result = $this->response->getMessage();
     } catch (\Exception $exception) {
         throw GuzzleRestException::createFromException($exception);
     }
     return $result;
 }
开发者ID:ramunasd,项目名称:platform,代码行数:12,代码来源:GuzzleRestResponse.php

示例3: testPingThrowsClientException

 /**
  * If the server returns an error 400 or above ping throws a PublishServerException
  * @group unit
  */
 public function testPingThrowsClientException()
 {
     $errorMessage = "some error";
     Phockito::when($this->mockResponse->getMessage())->return($errorMessage);
     Phockito::when($this->mockRequest->send())->return($this->mockResponse);
     Phockito::when($this->client)->get(anything())->return($this->mockRequest);
     for ($errorCode = 400; $errorCode < 506; $errorCode++) {
         Phockito::when($this->mockResponse->getStatusCode())->return($errorCode);
         try {
             $this->client->ping();
             $this->fail("Expected PublishServerException");
         } catch (PublishServiceClient\Exception\PublishServerException $ex) {
             $this->assertEquals("Server error occurred. Error code: " . $errorCode . " Response: " . $errorMessage, $ex->getMessage());
             Phockito::reset($this->mockResponse, 'getStatusCode');
         }
     }
 }
开发者ID:balihoo,项目名称:publish-service-client,代码行数:21,代码来源:ClientTest.php

示例4: testGetMessage

 /**
  * @covers Guzzle\Http\Message\Response::getMessage
  */
 public function testGetMessage()
 {
     $response = new Response(200, new Collection(array('Content-Length' => 4)), 'body');
     $this->assertEquals("HTTP/1.1 200 OK\r\nContent-Length: 4\r\n\r\nbody", $response->getMessage());
 }
开发者ID:KANU82,项目名称:guzzle,代码行数:8,代码来源:ResponseTest.php

示例5: processResponse

 private function processResponse(Response $response)
 {
     if (!$response->isSuccessful()) {
         throw new ApiServerException($response->getMessage(), $response->getStatusCode());
     }
     if (self::FORMAT_ARRAY === $this->outputFormat) {
         return $response->json();
     }
     return $response->getBody(true);
 }
开发者ID:bitblower,项目名称:mailjet-api-php,代码行数:10,代码来源:Client.php

示例6: __construct

 /**
  * @param Response $response
  */
 public function __construct(Response $response)
 {
     parent::__construct("Server error occurred. Error code: " . $response->getStatusCode() . " Response: " . $response->getMessage());
 }
开发者ID:balihoo,项目名称:publish-service-client,代码行数:7,代码来源:PublishServerException.php


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