Chris@0: Chris@0: * Chris@0: * For the full copyright and license information, please view the LICENSE Chris@0: * file that was distributed with this source code. Chris@0: */ Chris@0: Chris@0: namespace Symfony\Component\DependencyInjection; Chris@0: Chris@0: class Alias Chris@0: { Chris@0: private $id; Chris@0: private $public; Chris@14: private $private; Chris@0: Chris@0: /** Chris@0: * @param string $id Alias identifier Chris@0: * @param bool $public If this alias is public Chris@0: */ Chris@0: public function __construct($id, $public = true) Chris@0: { Chris@14: $this->id = (string) $id; Chris@0: $this->public = $public; Chris@17: $this->private = 2 > \func_num_args(); Chris@0: } Chris@0: Chris@0: /** Chris@0: * Checks if this DI Alias should be public or not. Chris@0: * Chris@0: * @return bool Chris@0: */ Chris@0: public function isPublic() Chris@0: { Chris@0: return $this->public; Chris@0: } Chris@0: Chris@0: /** Chris@0: * Sets if this Alias is public. Chris@0: * Chris@0: * @param bool $boolean If this Alias should be public Chris@14: * Chris@14: * @return $this Chris@0: */ Chris@0: public function setPublic($boolean) Chris@0: { Chris@0: $this->public = (bool) $boolean; Chris@14: $this->private = false; Chris@14: Chris@14: return $this; Chris@14: } Chris@14: Chris@14: /** Chris@14: * Sets if this Alias is private. Chris@14: * Chris@14: * When set, the "private" state has a higher precedence than "public". Chris@14: * In version 3.4, a "private" alias always remains publicly accessible, Chris@14: * but triggers a deprecation notice when accessed from the container, Chris@14: * so that the alias can be made really private in 4.0. Chris@14: * Chris@14: * @param bool $boolean Chris@14: * Chris@14: * @return $this Chris@14: */ Chris@14: public function setPrivate($boolean) Chris@14: { Chris@14: $this->private = (bool) $boolean; Chris@14: Chris@14: return $this; Chris@14: } Chris@14: Chris@14: /** Chris@14: * Whether this alias is private. Chris@14: * Chris@14: * @return bool Chris@14: */ Chris@14: public function isPrivate() Chris@14: { Chris@14: return $this->private; Chris@0: } Chris@0: Chris@0: /** Chris@0: * Returns the Id of this alias. Chris@0: * Chris@0: * @return string The alias id Chris@0: */ Chris@0: public function __toString() Chris@0: { Chris@0: return $this->id; Chris@0: } Chris@0: }