Chris@14: Chris@14: * Chris@14: * For the full copyright and license information, please view the LICENSE Chris@14: * file that was distributed with this source code. Chris@14: */ Chris@14: Chris@14: namespace Symfony\Component\DependencyInjection\Loader\Configurator; Chris@14: Chris@14: use Symfony\Component\DependencyInjection\ContainerInterface; Chris@14: Chris@14: /** Chris@14: * @author Nicolas Grekas
Chris@14: */ Chris@14: class ReferenceConfigurator extends AbstractConfigurator Chris@14: { Chris@14: /** @internal */ Chris@14: protected $id; Chris@14: Chris@14: /** @internal */ Chris@14: protected $invalidBehavior = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE; Chris@14: Chris@14: public function __construct($id) Chris@14: { Chris@14: $this->id = $id; Chris@14: } Chris@14: Chris@14: /** Chris@14: * @return $this Chris@14: */ Chris@14: final public function ignoreOnInvalid() Chris@14: { Chris@14: $this->invalidBehavior = ContainerInterface::IGNORE_ON_INVALID_REFERENCE; Chris@14: Chris@14: return $this; Chris@14: } Chris@14: Chris@14: /** Chris@14: * @return $this Chris@14: */ Chris@14: final public function nullOnInvalid() Chris@14: { Chris@14: $this->invalidBehavior = ContainerInterface::NULL_ON_INVALID_REFERENCE; Chris@14: Chris@14: return $this; Chris@14: } Chris@14: Chris@14: /** Chris@14: * @return $this Chris@14: */ Chris@14: final public function ignoreOnUninitialized() Chris@14: { Chris@14: $this->invalidBehavior = ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE; Chris@14: Chris@14: return $this; Chris@14: } Chris@14: Chris@14: public function __toString() Chris@14: { Chris@14: return $this->id; Chris@14: } Chris@14: }