/** * Creates a callable function used to create command objects from a * service description. * * @param DescriptionInterface $description Service description * * @return callable Returns a command factory */ public static function defaultCommandFactory(DescriptionInterface $description) { return function ($name, array $args = [], GuzzleClientInterface $client) use($description) { $operation = null; if ($description->hasOperation($name)) { $operation = $description->getOperation($name); } else { $name = ucfirst($name); if ($description->hasOperation($name)) { $operation = $description->getOperation($name); } } if (!$operation) { return null; } return new Command($operation, $args, clone $client->getEmitter()); }; }