当前位置: 首页>>代码示例>>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;未经允许,请勿转载。