DefinitionDecorator.php in Zircon Profile 8.0
File
vendor/symfony/dependency-injection/DefinitionDecorator.php
View source
<?php
namespace Symfony\Component\DependencyInjection;
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
use Symfony\Component\DependencyInjection\Exception\OutOfBoundsException;
class DefinitionDecorator extends Definition {
private $parent;
private $changes = array();
public function __construct($parent) {
parent::__construct();
$this->parent = $parent;
}
public function getParent() {
return $this->parent;
}
public function getChanges() {
return $this->changes;
}
public function setClass($class) {
$this->changes['class'] = true;
return parent::setClass($class);
}
public function setFactory($callable) {
$this->changes['factory'] = true;
return parent::setFactory($callable);
}
public function setFactoryClass($class) {
$this->changes['factory_class'] = true;
return parent::setFactoryClass($class);
}
public function setFactoryMethod($method) {
$this->changes['factory_method'] = true;
return parent::setFactoryMethod($method);
}
public function setFactoryService($service) {
$this->changes['factory_service'] = true;
return parent::setFactoryService($service);
}
public function setConfigurator($callable) {
$this->changes['configurator'] = true;
return parent::setConfigurator($callable);
}
public function setFile($file) {
$this->changes['file'] = true;
return parent::setFile($file);
}
public function setPublic($boolean) {
$this->changes['public'] = true;
return parent::setPublic($boolean);
}
public function setLazy($boolean) {
$this->changes['lazy'] = true;
return parent::setLazy($boolean);
}
public function setDecoratedService($id, $renamedId = null) {
$this->changes['decorated_service'] = true;
return parent::setDecoratedService($id, $renamedId);
}
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];
}
public function replaceArgument($index, $value) {
if (!is_int($index)) {
throw new InvalidArgumentException('$index must be an integer.');
}
$this->arguments['index_' . $index] = $value;
return $this;
}
}