本文整理汇总了PHP中Guzzle\Service\Command\CommandInterface::getName方法的典型用法代码示例。如果您正苦于以下问题:PHP CommandInterface::getName方法的具体用法?PHP CommandInterface::getName怎么用?PHP CommandInterface::getName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Guzzle\Service\Command\CommandInterface
的用法示例。
在下文中一共展示了CommandInterface::getName方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例2: 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.');
});
}
}
示例3: 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);
}
示例4: 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;
}
示例5: getClassName
public function getClassName(CommandInterface $command)
{
$className = $command->getName();
if (isset($this->map[$className])) {
return $this->map[$className];
} elseif (isset($this->map['*'])) {
return $this->map['*'];
}
return null;
}
示例6: getClassName
protected function getClassName(CommandInterface $command)
{
$iteratorName = $this->inflector->camel($command->getName()) . 'Iterator';
foreach ($this->namespaces as $namespace) {
$potentialClassName = $namespace . '\\' . $iteratorName;
if (class_exists($potentialClassName)) {
return $potentialClassName;
}
}
return false;
}
示例7: build
/**
* {@inheritdoc}
*/
public function build(CommandInterface $command, array $options = array())
{
// Get the configuration data for the command
$commandName = $command->getName();
$iteratorConfig = $this->operations->get($commandName) ?: array();
$options = array_replace($this->config->getAll(), $iteratorConfig, $options);
// Instantiate the iterator using the primary factory (if there is one)
if ($this->primaryIteratorFactory && $this->primaryIteratorFactory->canBuild($command)) {
$iterator = $this->primaryIteratorFactory->build($command, $options);
} elseif (!$this->operations->hasKey($commandName)) {
throw new InvalidArgumentException("Iterator was not found for {$commandName}.");
} else {
// Fallback to this factory for creating the iterator if the primary factory did not work
$iterator = new AwsResourceIterator($command, $options);
}
return $iterator;
}
示例8: build
public function build(CommandInterface $command, array $options = array())
{
// Get the configuration data for the command
$commandName = $command->getName();
$commandSupported = isset($this->config[$commandName]);
$options = $this->translateLegacyConfigOptions($options);
$options += $commandSupported ? $this->config[$commandName] : array();
// Instantiate the iterator using the primary factory (if one was provided)
if ($this->primaryIteratorFactory && $this->primaryIteratorFactory->canBuild($command)) {
$iterator = $this->primaryIteratorFactory->build($command, $options);
} elseif (!$commandSupported) {
throw new InvalidArgumentException("Iterator was not found for {$commandName}.");
} else {
// Instantiate a generic AWS resource iterator
$iterator = new MssResourceIterator($command, $options);
}
return $iterator;
}
示例9: build
/**
* Create a resource iterator
*
* @param CommandInterface $data Command used for building the iterator
* @param array $options Iterator options that are exposed as data.
*
* @return ResourceIteratorInterface
*/
public function build($data, array $options = array())
{
if (!$data instanceof CommandInterface) {
throw new InvalidArgumentException('The first argument must be an instance of CommandInterface');
}
$iteratorName = $this->inflector->camel($data->getName()) . 'Iterator';
// Determine the name of the class to load
$className = null;
foreach ($this->namespaces as $namespace) {
$potentialClassName = $namespace . '\\' . $iteratorName;
if (class_exists($potentialClassName)) {
$className = $potentialClassName;
break;
}
}
if (!$className) {
throw new InvalidArgumentException("Iterator was not found matching {$iteratorName}");
}
return new $className($data, $options);
}
示例10: getClassName
protected function getClassName(CommandInterface $command)
{
$iteratorName = $this->inflector->camel($command->getName()) . 'Iterator';
$iteratorSpecified = $command->getOperation()->getData('iteratorClass');
// @TODO fix this near duplication
if (!is_null($iteratorSpecified)) {
foreach ($this->namespaces as $namespace) {
$potentialClassName = $namespace . '\\' . $iteratorSpecified;
if (class_exists($potentialClassName)) {
return $potentialClassName;
}
}
}
foreach ($this->namespaces as $namespace) {
$potentialClassName = $namespace . '\\' . $iteratorName;
if (class_exists($potentialClassName)) {
return $potentialClassName;
}
}
return false;
}