本文整理汇总了PHP中Guzzle\Service\Command\CommandInterface::toArray方法的典型用法代码示例。如果您正苦于以下问题:PHP CommandInterface::toArray方法的具体用法?PHP CommandInterface::toArray怎么用?PHP CommandInterface::toArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Guzzle\Service\Command\CommandInterface
的用法示例。
在下文中一共展示了CommandInterface::toArray方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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');
}
示例2: prepareAdditionalParameters
protected function prepareAdditionalParameters(OperationInterface $operation, CommandInterface $command, RequestInterface $request, Parameter $additional)
{
if (!($location = $additional->getLocation())) {
return;
}
$visitor = $this->factory->getRequestVisitor($location);
$hidden = $command[$command::HIDDEN_PARAMS];
foreach ($command->toArray() as $key => $value) {
if ($value !== null && !in_array($key, $hidden) && !$operation->hasParam($key)) {
$additional->setName($key);
$visitor->visit($command, $request, $additional, $value);
}
}
return $visitor;
}