當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。