當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Response::isSuccessful方法代碼示例

本文整理匯總了PHP中Buzz\Message\Response::isSuccessful方法的典型用法代碼示例。如果您正苦於以下問題:PHP Response::isSuccessful方法的具體用法?PHP Response::isSuccessful怎麽用?PHP Response::isSuccessful使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Buzz\Message\Response的用法示例。


在下文中一共展示了Response::isSuccessful方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: __construct

 public function __construct(TransportResponse $response)
 {
     if (!$response->isSuccessful()) {
         throw new TransportException($response);
     }
     $this->response = $response;
 }
開發者ID:markey-magic,項目名稱:tractionphp,代碼行數:7,代碼來源:Response.php

示例2: rev

 public function rev(Response $response)
 {
     if ($response->isSuccessful()) {
         return $this->decode($response->getHeader('Etag'));
     }
     throw new RugException('not_found', 'The specified document or revision cannot be found or has been deleted');
 }
開發者ID:o100ja,項目名稱:rug,代碼行數:7,代碼來源:AbstractDocumentParser.php

示例3: isSuccessful

 public function isSuccessful()
 {
     if (parent::isSuccessful()) {
         $result = $this->getArrayResult();
         return !array_key_exists('error', $result);
     }
     return false;
 }
開發者ID:alitvinenko,項目名稱:google-api-bundle,代碼行數:8,代碼來源:Response.php

示例4: doRequest

 /**
  * @param FormRequest $request
  *
  * @throws HttpException
  *
  * @return array
  */
 protected function doRequest(FormRequest $request)
 {
     $request->setMethod('POST');
     $request->fromUrl($this->getApiEndpoint());
     $this->client->send($request, $response = new Response());
     if (false == $response->isSuccessful()) {
         throw HttpException::factory($request, $response);
     }
     $result = array();
     parse_str($response->getContent(), $result);
     foreach ($result as &$value) {
         $value = urldecode($value);
     }
     return $result;
 }
開發者ID:sanchojaf,項目名稱:oldmytriptocuba,代碼行數:22,代碼來源:Api.php

示例5: assertRequestIsSuccessful

 /**
  * @param \Buzz\Message\Response $response
  * @throws \InvalidArgumentException
  */
 private function assertRequestIsSuccessful(\Buzz\Message\Response $response)
 {
     $data = json_decode($response->getContent(), true);
     if (!$response->isSuccessful() || !isset($data['success']) || $data['success'] != "true") {
         //XXX Invent Exception fitting here
         throw new \InvalidArgumentException($response->getContent());
     }
 }
開發者ID:rgies,項目名稱:dsp,代碼行數:12,代碼來源:Client.php

示例6: getResult

 /**
  * @param \Buzz\Message\Response $response
  *
  * @throws HttpException if status not OK
  * @throws HttpException if content not json
  *
  * @return \stdClass|\stdClass[]|null
  */
 protected function getResult(Response $response)
 {
     if (false == $response->isSuccessful()) {
         throw new HttpException($response->getStatusCode(), sprintf("The api call finished with status %s but it was expected 200. Response content:\n\n%s", $response->getStatusCode(), $response->getContent()));
     }
     $content = $response->getContent();
     $result = null;
     if (false == empty($content)) {
         $result = json_decode($response->getContent());
         if (null === $result) {
             throw new LogicException(sprintf("The response status is successful but the content is not a valid json object:\n\n%s", $response->getContent()));
         }
     }
     return $result;
 }
開發者ID:bluestatedigital,項目名稱:akamai-api-client,代碼行數:23,代碼來源:Client.php

示例7: handleResponse

 /**
  * @param Response $response
  *
  * @throws HttpException
  */
 protected function handleResponse(Response $response)
 {
     if ($response->isSuccessful()) {
         return;
     }
     $this->handleError($response);
 }
開發者ID:softr,項目名稱:asaas-php-sdk,代碼行數:12,代碼來源:BuzzAdapter.php

示例8: isSuccessful

 /**
  * @return bool
  */
 public function isSuccessful()
 {
     return $this->response->isSuccessful();
 }
開發者ID:looptribe,項目名稱:paytoshi-library-php,代碼行數:7,代碼來源:ApiResponse.php


注:本文中的Buzz\Message\Response::isSuccessful方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。