public function DefinitionDecorator::getArgument

Gets an argument to pass to the service constructor/factory method.

If replaceArgument() has been used to replace an argument, this method will return the replacement value.

@api

Parameters

integer $index:

Return value

mixed The argument value

Overrides Definition::getArgument

File

drupal/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/DefinitionDecorator.php, line 164

Class

DefinitionDecorator
This definition decorates another definition.

Namespace

Symfony\Component\DependencyInjection

Code

public function getArgument($index) {
  if (array_key_exists('index_' . $index, $this->arguments)) {
    return $this->arguments['index_' . $index];
  }
  $lastIndex = count(array_filter(array_keys($this->arguments), 'is_int')) - 1;
  if ($index < 0 || $index > $lastIndex) {
    throw new OutOfBoundsException(sprintf('The index "%d" is not in the range [0, %d].', $index, $lastIndex));
  }
  return $this->arguments[$index];
}