當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。