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/Components/DependencyInjection/Reference.php

55 lines
1.2 KiB
PHP
Raw Normal View History

2010-01-04 14:26:20 +00:00
<?php
namespace Symfony\Components\DependencyInjection;
/*
* This file is part of the Symfony framework.
2010-01-04 14:26:20 +00:00
*
* (c) Fabien Potencier <fabien.potencier@symfony-project.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
/**
* Reference represents a service reference.
*
* @package Symfony
* @subpackage Components_DependencyInjection
2010-01-04 14:26:20 +00:00
* @author Fabien Potencier <fabien.potencier@symfony-project.com>
*/
class Reference
{
protected $id;
protected $invalidBehavior;
2010-01-04 14:26:20 +00:00
/**
* Constructor.
*
* @param string $id The service identifier
* @param int $invalidBehavior The behavior when the service does not exist
*
* @see Container
*/
public function __construct($id, $invalidBehavior = Container::EXCEPTION_ON_INVALID_REFERENCE)
{
$this->id = $id;
$this->invalidBehavior = $invalidBehavior;
}
2010-01-04 14:26:20 +00:00
/**
* __toString.
*
* @return string The service identifier
*/
public function __toString()
{
return (string) $this->id;
}
2010-01-04 14:26:20 +00:00
public function getInvalidBehavior()
{
return $this->invalidBehavior;
}
2010-01-04 14:26:20 +00:00
}