Symfony\Component\DependencyInjection\Definition::replaceArgument PHP Method

replaceArgument() public method

Sets a specific argument.
public replaceArgument ( integer $index, mixed $argument ) : Definition
$index integer
$argument mixed
return Definition The current instance
    public function replaceArgument($index, $argument)
    {
        if ($index < 0 || $index > count($this->arguments) - 1) {
            throw new OutOfBoundsException(sprintf('The index "%d" is not in the range [0, %d].', $index, count($this->arguments) - 1));
        }

        $this->arguments[$index] = $argument;

        return $this;
    }

Usage Example

Example #1
0
 /**
  * Sets a specific argument
  *
  * @param integer $index
  * @param mixed   $argument
  *
  * @return tubepress_api_ioc_DefinitionInterface The current instance
  *
  * @throws OutOfBoundsException When the replaced argument does not exist
  *
  * @api
  * @since 4.0.0
  */
 public function replaceArgument($index, $argument)
 {
     $cleaned = $this->convertToSymfonyReferenceIfNecessary($argument);
     try {
         $this->_underlyingSymfonyDefinition->replaceArgument($index, $cleaned);
     } catch (\Symfony\Component\DependencyInjection\Exception\OutOfBoundsException $e) {
         throw new OutOfBoundsException($e);
     }
     return $this;
 }
All Usage Examples Of Symfony\Component\DependencyInjection\Definition::replaceArgument