• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Command\CommandInterface类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: visit

 public function visit(CommandInterface $command, RequestInterface $request, Parameter $param, $value)
 {
     $this->fqname = $command->getName();
     $query = array();
     $this->customResolver($value, $param, $query, $param->getWireName());
     $request->addPostFields($query);
 }
开发者ID:loulancn,项目名称:core,代码行数:7,代码来源:AwsQueryVisitor.php


示例2: fromCommand

 /**
  * Create a new model instance from a command.
  *
  * @param  CommandInterface
  * @return array
  */
 public static function fromCommand(CommandInterface $command)
 {
     $file = new self();
     $file->setParameters($command->getResponse()->json() + array('path' => $command['path']));
     $file->finishUpload();
     return $file->getParameters();
 }
开发者ID:tvpsoft,项目名称:laravel-kinvey,代码行数:13,代码来源:KinveyFileResponse.php


示例3: after

public function after(CommandInterface $command, RequestInterface $request)
{
$xml = null;


 if (isset($this->data[$command])) {
$xml = $this->finishDocument($this->data[$command]);
unset($this->data[$command]);
} else {

 $operation = $command->getOperation();
if ($operation->getData('xmlAllowEmpty')) {
$xmlWriter = $this->createRootElement($operation);
$xml = $this->finishDocument($xmlWriter);
}
}

if ($xml) {

 if ($this->contentType && !$request->hasHeader('Content-Type')) {
$request->setHeader('Content-Type', $this->contentType);
}
$request->setBody($xml);
}
}
开发者ID:Ryu0621,项目名称:SaNaVi,代码行数:25,代码来源:XmlVisitor.php


示例4: handleParsing

 protected function handleParsing(CommandInterface $command, Response $response, $contentType)
 {
     $operation = $command->getOperation();
     $type = $operation->getResponseType();
     $model = null;
     if ($type == OperationInterface::TYPE_MODEL) {
         $model = $operation->getServiceDescription()->getModel($operation->getResponseClass());
     } elseif ($type == OperationInterface::TYPE_CLASS) {
         $responseClassInterface = __NAMESPACE__ . '\\ResponseClassInterface';
         $className = $operation->getResponseClass();
         if (!class_exists($className)) {
             throw new ResponseClassException("{$className} does not exist");
         } elseif (!method_exists($className, 'fromCommand')) {
             throw new ResponseClassException("{$className} must implement {$responseClassInterface}");
         }
         return $className::fromCommand($command);
     }
     if (!$model) {
         // Return basic processing if the responseType is not model or the model cannot be found
         return parent::handleParsing($command, $response, $contentType);
     } elseif ($command[AbstractCommand::RESPONSE_PROCESSING] != AbstractCommand::TYPE_MODEL) {
         // Returns a model with no visiting if the command response processing is not model
         return new Model(parent::handleParsing($command, $response, $contentType), $model);
     } else {
         return new Model($this->visitResult($model, $command, $response), $model);
     }
 }
开发者ID:creazy412,项目名称:vmware-win10-c65-drupal7,代码行数:27,代码来源:OperationResponseParser.php


示例5: runCommand

 /**
  * @param  CommandInterface $command
  * @return EncodingResponse
  */
 protected function runCommand($command)
 {
     try {
         return $command->getResult();
     } catch (\Exception $e) {
         throw new RuntimeException('Could not run encoding.com request.', 0, $e);
     }
 }
开发者ID:phpro,项目名称:zf-encoding-com,代码行数:12,代码来源:Client.php


示例6: hook_amazons3_command_alter

/**
 * Allows modules to alter an S3 command after it has been created.
 *
 * @param \Guzzle\Service\Command\CommandInterface $command
 *   The command that was created.
 */
function hook_amazons3_command_alter(\Guzzle\Service\Command\CommandInterface $command)
{
    if ($command->getName('HeadObject')) {
        $command->setOnComplete(function () {
            watchdog('amazons3', 'HeadObject was called.');
        });
    }
}
开发者ID:vuhoanglinh2002,项目名称:drupal,代码行数:14,代码来源:amazons3.api.php


示例7: addMd5

 private function addMd5(CommandInterface $command)
 {
     $request = $command->getRequest();
     if ($body = $request->getBody()) {
         if (false !== ($md5 = $body->getContentMd5(true, true))) {
             $request->setHeader('Content-MD5', $md5);
         }
     }
 }
开发者ID:viggi2004,项目名称:datacollector-backend,代码行数:9,代码来源:S3Md5Listener.php


示例8: build

 /**
  * Create a resource iterator
  *
  * @param CommandInterface $data    Command used for building the iterator
  * @param array            $options Iterator options.
  *
  * @return ResourceIteratorInterface
  */
 public function build($data, array $options = null)
 {
     if (!$data instanceof CommandInterface) {
         throw new InvalidArgumentException('The first argument must be an ' . 'instance of CommandInterface');
     }
     // Determine the name of the class to load
     $className = $this->baseNamespace . '\\' . Inflector::camel($data->getName()) . 'Iterator';
     return new $className($data, $options);
 }
开发者ID:norv,项目名称:guzzle,代码行数:17,代码来源:ResourceIteratorClassFactory.php


示例9: getClassName

 /**
  * {@inheritdoc}
  */
 protected function getClassName(CommandInterface $command)
 {
     // If it's a ListWidgets command, we can iterate over it
     if (preg_match('/^List[A-Za-z]+/', $command->getName())) {
         return $this->iteratorClassName;
     }
     // Otherwise, we don't know how to iterate over that command
     return null;
 }
开发者ID:dh-open,项目名称:desk-php,代码行数:12,代码来源:Factory.php


示例10: createLinkCommand

 /**
  * {@inheritdoc}
  */
 public function createLinkCommand(CommandInterface $command, Parameter $structure, array $data)
 {
     $this->validateLink($data);
     $this->validateLinkStructure($structure);
     $operation = $structure->getData('operation');
     $pattern = $structure->getData('pattern');
     $params = $this->parseHref($data['href'], $pattern);
     return $command->getClient()->getCommand($operation, $params);
 }
开发者ID:dh-open,项目名称:desk-php,代码行数:12,代码来源:CommandBuilder.php


示例11: addMd5

 private function addMd5(CommandInterface $command)
 {
     $request = $command->getRequest();
     if ($body = $request->getBody()) {
         if (false === ($md5 = $body->getContentMd5(true, true))) {
             throw new RuntimeException('Unable to add a MD5 checksum');
         }
         $request->setHeader('Content-MD5', $md5);
     }
 }
开发者ID:iLoiLohas,项目名称:pinchshopper,代码行数:10,代码来源:S3Md5Listener.php


示例12: parse

 public function parse(CommandInterface $command)
 {
     $response = $command->getRequest()->getResponse();
     if ($contentType = $command['command.expects']) {
         $response->setHeader('Content-Type', $contentType);
     } else {
         $contentType = (string) $response->getHeader('Content-Type');
     }
     return $this->handleParsing($command, $response, $contentType);
 }
开发者ID:Ryu0621,项目名称:SaNaVi,代码行数:10,代码来源:DefaultResponseParser.php


示例13: before

 /**
  * {@inheritdoc}
  */
 public function before(CommandInterface $command, array &$result)
 {
     $json = $command->getResponse()->json();
     // store links to use later
     if (array_key_exists($this->getOutputFieldName(), $json)) {
         $this->set($command, $this->getFieldName(), $json[$this->getOutputFieldName()]);
     }
     // create new array of links which visit() adds to
     $result[$this->getOutputFieldName()] = array();
 }
开发者ID:dh-open,项目名称:desk-php,代码行数:13,代码来源:AbstractVisitor.php


示例14: factory

 /**
  * {@inheritdoc}
  */
 public function factory(CommandInterface $originalCommand, array $data)
 {
     $command = $this->newCommand();
     // set up embedded command
     $command->setClient($originalCommand->getClient());
     $originalResponse = $originalCommand->getResponse();
     $response = $this->createResponse($originalResponse, $data);
     $command->setResponse($response);
     return $command;
 }
开发者ID:kameshwariv,项目名称:testexample,代码行数:13,代码来源:EmbeddedCommandFactory.php


示例15: createPresignedUrl

 private function createPresignedUrl(AwsClientInterface $client, CommandInterface $command)
 {
     // Create a temporary client used to generate the presigned URL
     $newClient = Ec2Client::factory(array('region' => $command['SourceRegion'], 'signature' => 'v4', 'credentials' => $client->getCredentials()));
     $preCommand = $newClient->getCommand('CopySnapshot', $command->toArray());
     $preCommand['__internal'] = true;
     /** @var \Guzzle\Http\Message\EntityEnclosingRequest $preRequest */
     $preRequest = $preCommand->prepare();
     return $newClient->getSignature()->createPresignedUrl(SignatureV4::convertPostToGet($preRequest), $newClient->getCredentials(), '+1 hour');
 }
开发者ID:sohel4r,项目名称:wordpress_4_1_1,代码行数:10,代码来源:CopySnapshotListener.php


示例16: getClassName

 public function getClassName(CommandInterface $command)
 {
     $className = $command->getName();
     if (isset($this->map[$className])) {
         return $this->map[$className];
     } elseif (isset($this->map['*'])) {
         return $this->map['*'];
     }
     return null;
 }
开发者ID:Ryu0621,项目名称:SaNaVi,代码行数:10,代码来源:MapResourceIteratorFactory.php


示例17: before

 /**
  * {@inheritdoc}
  */
 public function before(CommandInterface $command, array &$result)
 {
     $json = $command->getResponse()->json();
     // store links to use later
     if (array_key_exists(self::ELEMENT, $json)) {
         $this->set($command, 'links', $json[self::ELEMENT]);
     }
     // create new array of links which visit() adds to
     $result[self::ELEMENT] = array();
 }
开发者ID:kameshwariv,项目名称:testexample,代码行数:13,代码来源:LinksVisitor.php


示例18: parseClass

 /**
  * Parse a class object
  *
  * @param CommandInterface $command Command to parse into an object
  *
  * @return mixed
  * @throws ResponseClassException
  */
 protected function parseClass(CommandInterface $command)
 {
     $className = $command->getOperation()->getResponseClass();
     if (!class_exists($className)) {
         throw new ResponseClassException("{$className} does not exist");
     }
     if (!method_exists($className, 'fromCommand')) {
         throw new ResponseClassException("{$className} must implement the fromCommand() method");
     }
     return $className::fromCommand($command);
 }
开发者ID:ebeauchamps,项目名称:brilliantretail,代码行数:19,代码来源:OperationResponseParser.php


示例19: getClassName

 protected function getClassName(CommandInterface $command)
 {
     $iteratorName = $this->inflector->camel($command->getName()) . 'Iterator';
     foreach ($this->namespaces as $namespace) {
         $potentialClassName = $namespace . '\\' . $iteratorName;
         if (class_exists($potentialClassName)) {
             return $potentialClassName;
         }
     }
     return false;
 }
开发者ID:Ryu0621,项目名称:SaNaVi,代码行数:11,代码来源:ResourceIteratorClassFactory.php


示例20: parseClass

 protected function parseClass(CommandInterface $command)
 {
     $event = new CreateResponseClassEvent(array('command' => $command));
     $command->getClient()->getEventDispatcher()->dispatch('command.parse_response', $event);
     if ($result = $event->getResult()) {
         return $result;
     }
     $className = $command->getOperation()->getResponseClass();
     if (!method_exists($className, 'fromCommand')) {
         throw new ResponseClassException("{$className} must exist and implement a static fromCommand() method");
     }
     return $className::fromCommand($command);
 }
开发者ID:Ryu0621,项目名称:SaNaVi,代码行数:13,代码来源:OperationResponseParser.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Command\OperationCommand类代码示例发布时间:2022-05-23
下一篇:
PHP Service\Client类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap