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


PHP OperationCommand::getResponse方法代码示例

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


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

示例1: fromCommand

 public static function fromCommand(OperationCommand $command)
 {
     $response = json_decode($command->getResponse()->getBody(true), true);
     $class = get_called_class();
     // Cannot do new self() with abstract class
     return new $class($response);
 }
开发者ID:hautelook,项目名称:rabbitmq-api,代码行数:7,代码来源:AbstractRabbitMQModel.php

示例2: fromCommand

 /**
  * The fromCommand method is used by Guzzle to create an instance of this class. It "injects"
  * the response data, which is then parsed to populate this and the associated models.
  *
  * @param Guzzle\Service\Command\OperationCommand
  * @return array
  */
 public static function fromCommand(\Guzzle\Service\Command\OperationCommand $command)
 {
     // Grab the results, which will be in JSON format
     //krumo($command->getResponse());
     $result = $command->getResponse()->json();
     // Start building an array, since a call to the API can include several different sites
     $websites = array();
     // Now iterate through the results
     foreach ($result as $key => $row) {
         // "Target" is a stripped-down version of the URL provided
         $url = $row['target'];
         // Create a new Website model
         $website = new Website($url);
         // The 0 axis holds information about trustworthiness
         if (isset($row[0])) {
             $website->setTrustworthiness($row[0][0], $row[0][1]);
         }
         // The 4 axis contins information pertaining to child satefy
         if (isset($row[4])) {
             $website->setChildSafety($row[4][0], $row[4][1]);
         }
         // NOTE: the axes in indexes 1 and 2 are deprecated.
         // If any categories are specified, set them
         if (isset($row['categories'])) {
             $website->setCategories($row['categories']);
         }
         // If provided, set the blacklist information; we'll discard the timestamp information
         if (isset($row['blacklists'])) {
             $website->setBlacklists(array_keys($row['blacklists']));
         }
         // Add the website
         $websites[$key] = $website;
     }
     return $websites;
 }
开发者ID:lukaswhite,项目名称:weboftrust,代码行数:42,代码来源:ResponseParser.php

示例3: fromCommand

 /**
  * {@inheritdoc}
  */
 public static function fromCommand(OperationCommand $command)
 {
     $data = $command->getResponse()->json();
     $brandAddress = self::hydrateModelProperties(new Address(), $data['agentBrand']['address']);
     $brand = self::hydrateModelProperties(new Brand(), $data['agentBrand'], array(), array('address' => $brandAddress));
     $address = self::hydrateModelProperties(new Address(), $data['address']);
     return self::hydrateModelProperties(new self(), $data, array(), array('address' => $address, 'agentBrand' => $brand));
 }
开发者ID:AlexEvesDeveloper,项目名称:hl-stuff,代码行数:11,代码来源:Agent.php

示例4: fromCommand

 /**
  * {@inheritdoc}
  */
 public static function fromCommand(OperationCommand $command)
 {
     $items = new Collection();
     foreach ($command->getResponse()->json() as $key => $item) {
         $items[$key] = self::hydrateModelProperties(new self(), $item, array('address1' => 'addressLineOne', 'address2' => 'addressLineTwo', 'address3' => 'addressLineThree', 'address4' => 'addressLineFour', 'address5' => 'addressLineFive'));
     }
     return $items;
 }
开发者ID:AlexEvesDeveloper,项目名称:hl-stuff,代码行数:11,代码来源:PafAddress.php

示例5: fromCommand

 /**
  * {@inheritdoc}
  */
 public static function fromCommand(OperationCommand $command)
 {
     $activities = new Collection();
     foreach ($command->getResponse()->json() as $key => $activity) {
         $activities->add($key, self::hydrateModelProperties(new self(), $activity));
     }
     return $activities;
 }
开发者ID:AlexEvesDeveloper,项目名称:hl-stuff,代码行数:11,代码来源:Activity.php

示例6: fromCommand

 public static function fromCommand(OperationCommand $command)
 {
     $xml = $command->getResponse()->xml();
     if (!isset($xml->AuthInfo)) {
         throw new AuthenticationException((string) $xml, $xml->attributes()['errorcode']);
     }
     $authToken = (string) $xml->AuthInfo->attributes()['authToken'];
     return $authToken;
 }
开发者ID:isometriks,项目名称:galves-api,代码行数:9,代码来源:AuthenticateDealer.php

示例7: fromCommand

 /**
  * {@inheritdoc}
  */
 public static function fromCommand(OperationCommand $command)
 {
     // If there is no content then assume an empty collection
     if (204 == $command->getResponse()->getStatusCode()) {
         return new Collection();
     }
     $data = $command->getResponse()->json();
     // Collection of products
     if (self::isResponseDataIndexedArray($data)) {
         $products = new Collection();
         foreach ($data as $key => $productData) {
             $products->add($key, self::hydrateModelProperties(new self(), $productData, array('productId' => 'id')));
         }
         return $products;
     } else {
         return self::hydrateModelProperties(new self(), $data, array('productId' => 'id'));
     }
 }
开发者ID:AlexEvesDeveloper,项目名称:hl-stuff,代码行数:21,代码来源:Product.php

示例8: fromCommand

 /**
  * Create a response model object from a completed command.
  *
  * @param OperationCommand $command That serialized the request
  * @return \Illuminate\Support\Collection
  */
 public static function fromCommand(OperationCommand $command)
 {
     // Initialize the collection
     $collection = new self($command->getResponse()->json());
     // Set the Usergrid API client on the collection
     $collection->setApiClient($command->getClient()->getApiClient());
     // Return the collection
     return $collection;
 }
开发者ID:rodsimpson,项目名称:incubator-usergrid,代码行数:15,代码来源:GuzzleCommandTrait.php

示例9: fromCommand

 public static function fromCommand(OperationCommand $command)
 {
     $response = $command->getResponse();
     $info = $response->getInfo();
     if ($info['content_type'] === 'image/png' || $info['content_type'] === 'image/jpg') {
         return new static(['logo' => $info['url']]);
     }
     throw new BadResponseException('Content type invalid. API returned ' . $info['content_type']);
 }
开发者ID:karllhughes,项目名称:clearbit-php,代码行数:9,代码来源:Logo.php

示例10: fromCommand

 public static function fromCommand(OperationCommand $command)
 {
     $xml = $command->getResponse()->xml();
     $styles = $xml->StyleList->style;
     $output = array();
     foreach ($styles as $style) {
         $output[(int) $style->attributes()['guid']] = trim((string) $style);
     }
     return $output;
 }
开发者ID:isometriks,项目名称:galves-api,代码行数:10,代码来源:GetStyles.php

示例11: fromCommand

 public static function fromCommand(OperationCommand $command)
 {
     $xml = $command->getResponse()->xml();
     $makes = $xml->MakeList->make;
     $output = array();
     foreach ($makes as $make) {
         $output[] = trim((string) $make);
     }
     return $output;
 }
开发者ID:isometriks,项目名称:galves-api,代码行数:10,代码来源:GetMakes.php

示例12: fromCommand

 public static function fromCommand(OperationCommand $command)
 {
     $xml = $command->getResponse()->xml();
     $years = $xml->YearList->year;
     $output = array();
     foreach ($years as $year) {
         $output[] = (int) $year;
     }
     return $output;
 }
开发者ID:isometriks,项目名称:galves-api,代码行数:10,代码来源:GetYears.php

示例13: fromCommand

 /**
  * Create a response model object from a completed command
  *
  * @param OperationCommand $command That serialized the request
  *
  * @return CurrencyCollection
  */
 public static function fromCommand(OperationCommand $command)
 {
     $response = $command->getResponse();
     $json = $response->json();
     $currencies = array();
     foreach ($json as $currency) {
         $currencies[] = new Currency($currency['code'], $currency['name'], $currency['rate']);
     }
     return new self($currencies);
 }
开发者ID:symm,项目名称:guzzle-bitpay,代码行数:17,代码来源:CurrencyCollection.php

示例14: fromCommand

 /**
  * FromCommand
  *
  * @return ResponseSearchModel
  * @author James Pudney
  */
 public static function fromCommand(OperationCommand $command)
 {
     $response = $command->getResponse();
     $json = $response->json();
     $columns = self::getColumnNames($json['response']['metaData']['columns']);
     $results = $json['response']['results'];
     // reformat the results
     $results = self::formatSearchResults($results, $columns);
     // return the model
     return new self($results, $columns);
 }
开发者ID:krzaczek,项目名称:Brightpearl-PHP,代码行数:17,代码来源:ResponseSearchModel.php

示例15: fromCommand

 public static function fromCommand(OperationCommand $command)
 {
     $json = $command->getResponse()->json();
     // support collections
     if (array_key_exists(0, $json)) {
         return array_map(function (array $properties) {
             return new static($properties);
         }, $json);
     }
     return new static($json);
 }
开发者ID:smaft-sarl,项目名称:okta-php-sdk,代码行数:11,代码来源:BaseModel.php


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