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


PHP Command\CommandInterface类代码示例

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


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


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