This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
symfony/src/Symfony/Component/DependencyInjection/Reference.php

54 lines
1.2 KiB
PHP
Raw Normal View History

2010-01-04 14:26:20 +00:00
<?php
/*
* This file is part of the Symfony package.
2010-01-04 14:26:20 +00:00
*
* (c) Fabien Potencier <fabien@symfony.com>
2010-01-04 14:26:20 +00:00
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
2010-01-04 14:26:20 +00:00
*/
namespace Symfony\Component\DependencyInjection;
2010-01-04 14:26:20 +00:00
/**
* Reference represents a service reference.
*
* @author Fabien Potencier <fabien@symfony.com>
2010-01-04 14:26:20 +00:00
*/
class Reference
{
private $id;
private $invalidBehavior;
2010-01-04 14:26:20 +00:00
/**
2014-11-30 13:33:44 +00:00
* @param string $id The service identifier
* @param int $invalidBehavior The behavior when the service does not exist
*
* @see Container
*/
2015-09-04 20:54:37 +01:00
public function __construct($id, $invalidBehavior = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE)
{
$this->id = (string) $id;
$this->invalidBehavior = $invalidBehavior;
}
2010-01-04 14:26:20 +00:00
/**
* @return string The service identifier
*/
public function __toString()
{
return $this->id;
}
2010-01-04 14:26:20 +00:00
2011-02-13 18:06:41 +00:00
/**
* Returns the behavior to be used when the service does not exist.
*
* @return int
*/
public function getInvalidBehavior()
{
return $this->invalidBehavior;
}
2010-01-04 14:26:20 +00:00
}