/** * @param ServiceClientInterface $client Client that executes commands. * @param CommandInterface $command Command being executed. * @param array $context Command context array of data. */ public function __construct(ServiceClientInterface $client, CommandInterface $command, array $context = []) { $this->serviceClient = $client; $this->client = $client->getHttpClient(); $this->command = $command; $this->context = new Collection($context); $this->state = 'init'; }
/** * Create a request for an operation with a uri merged onto a base URI */ private function createCommandWithUri(Operation $operation, CommandInterface $command, ServiceClientInterface $client) { // Get the path values and use the client config settings $variables = []; foreach ($operation->getParams() as $name => $arg) { /* @var Parameter $arg */ if ($arg->getLocation() == 'uri') { if (isset($command[$name])) { $variables[$name] = $arg->filter($command[$name]); if (!is_array($variables[$name])) { $variables[$name] = (string) $variables[$name]; } } } } // Expand the URI template. $uri = Utils::uriTemplate($operation->getUri(), $variables); return $client->getHttpClient()->createRequest($operation->getHttpMethod(), $this->description->getBaseUrl()->combine($uri), $command['request_options'] ?: []); }