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


PHP ServiceDescription::getData方法代码示例

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


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

示例1: getSignature

 /**
  * Return an appropriate signature object for a a client based on the
  * "signature" configuration setting, or the default signature specified in
  * a service description. The signature can be set to a valid signature
  * version identifier string or an instance of Aws\Common\Signature\SignatureInterface.
  *
  * @param ServiceDescription $description Description that holds a signature option
  * @param Collection         $config      Configuration options
  *
  * @return SignatureInterface
  * @throws InvalidArgumentException
  */
 protected function getSignature(ServiceDescription $description, Collection $config)
 {
     // If a custom signature has not been provided, then use the default
     // signature setting specified in the service description.
     $signature = $config->get(Options::SIGNATURE) ?: $description->getData('signatureVersion');
     if (is_string($signature)) {
         if ($signature == 'v4') {
             $signature = new SignatureV4();
         } elseif ($signature == 'v2') {
             $signature = new SignatureV2();
         } elseif ($signature == 'v3https') {
             $signature = new SignatureV3Https();
         } else {
             throw new InvalidArgumentException("Invalid signature type: {$signature}");
         }
     } elseif (!$signature instanceof SignatureInterface) {
         throw new InvalidArgumentException('The provided signature is not ' . 'a signature version string or an instance of ' . 'Aws\\Common\\Signature\\SignatureInterface');
     }
     // Allow a custom service name or region value to be provided
     if ($signature instanceof EndpointSignatureInterface) {
         // Determine the service name to use when signing
         $signature->setServiceName($config->get(Options::SIGNATURE_SERVICE) ?: $description->getData('signingName') ?: $description->getData('endpointPrefix'));
         // Determine the region to use when signing requests
         $signature->setRegionName($config->get(Options::SIGNATURE_REGION) ?: $config->get(Options::REGION));
     }
     return $signature;
 }
开发者ID:Trideon,项目名称:gigolo,代码行数:39,代码来源:ClientBuilder.php

示例2: testPersistsCustomAttributes

 public function testPersistsCustomAttributes()
 {
     $data = array('operations' => array('foo' => array('class' => 'foo', 'parameters' => array())), 'name' => 'Name', 'description' => 'Test', 'apiVersion' => '1.24', 'auth' => 'foo', 'keyParam' => 'bar');
     $d = new ServiceDescription($data);
     $d->setData('hello', 'baz');
     $this->assertEquals('foo', $d->getData('auth'));
     $this->assertEquals('baz', $d->getData('hello'));
     $this->assertEquals('bar', $d->getData('keyParam'));
     // responseClass and responseType are added by default
     $data['operations']['foo']['responseClass'] = 'array';
     $data['operations']['foo']['responseType'] = 'primitive';
     $this->assertEquals($data + array('hello' => 'baz'), json_decode($d->serialize(), true));
 }
开发者ID:alvarobfdev,项目名称:applog,代码行数:13,代码来源:ServiceDescriptionTest.php

示例3: getSignature

 /**
  * Return an appropriate signature object for a a client based on a description
  *
  * @param ServiceDescription $description Description that holds a signature option
  * @param Collection         $config      Configuration options
  *
  * @return SignatureInterface
  * @throws InvalidArgumentException
  */
 protected function getSignature(ServiceDescription $description, Collection $config)
 {
     if (!($signature = $config->get(Options::SIGNATURE))) {
         switch ($description->getData('signatureVersion')) {
             case 'v2':
                 $signature = new SignatureV2();
                 break;
             case 'v3':
                 $signature = new SignatureV3();
                 break;
             case 'v3https':
                 $signature = new SignatureV3Https();
                 break;
             case 'v4':
                 $signature = new SignatureV4();
                 break;
             default:
                 throw new InvalidArgumentException('Service description does not specify a valid signatureVersion');
         }
     }
     // Allow a custom service name or region value to be provided
     if ($signature instanceof EndpointSignatureInterface) {
         // Determine the service name to use when signing
         if (!($service = $config->get(Options::SIGNATURE_SERVICE))) {
             if (!($service = $description->getData('signingName'))) {
                 $service = $description->getData('endpointPrefix');
             }
         }
         $signature->setServiceName($service);
         // Determine the region to use when signing requests
         if (!($region = $config->get(Options::SIGNATURE_REGION))) {
             $region = $config->get(Options::REGION);
         }
         $signature->setRegionName($region);
     }
     return $signature;
 }
开发者ID:biribogos,项目名称:wikihow-src,代码行数:46,代码来源:ClientBuilder.php

示例4: addSignature

 /**
  * Return an appropriate signature object for a a client based on a description
  *
  * @param ServiceDescription $description Description that holds a signature option
  * @param Collection         $config      Configuration options
  *
  * @throws InvalidArgumentException
  */
 protected function addSignature(ServiceDescription $description, Collection $config)
 {
     if (!($signature = $config->get(Options::SIGNATURE))) {
         if (!$description->getData('signatureVersion')) {
             throw new InvalidArgumentException('The service description does not specify a signatureVersion');
         }
         switch ($description->getData('signatureVersion')) {
             case 'v2':
                 $signature = new SignatureV2();
                 break;
             case 'v3':
                 $signature = new SignatureV3();
                 break;
             case 'v3https':
                 $signature = new SignatureV3Https();
                 break;
             case 'v4':
                 $signature = new SignatureV4();
                 break;
         }
     }
     // Allow a custom service name or region value to be provided
     if ($signature instanceof EndpointSignatureInterface) {
         $signature->setServiceName($config->get(Options::SIGNATURE_SERVICE) ?: $description->getData('signingName'));
         $signature->setRegionName($config->get(Options::SIGNATURE_REGION));
     }
     $config->set(Options::SIGNATURE, $signature);
 }
开发者ID:noahkim,项目名称:kowop,代码行数:36,代码来源:ClientBuilder.php


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