Alias.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Component\DependencyInjection;
  11. class Alias
  12. {
  13. private $id;
  14. private $public;
  15. /**
  16. * @param string $id Alias identifier
  17. * @param bool $public If this alias is public
  18. */
  19. public function __construct($id, $public = true)
  20. {
  21. $this->id = strtolower($id);
  22. $this->public = $public;
  23. }
  24. /**
  25. * Checks if this DI Alias should be public or not.
  26. *
  27. * @return bool
  28. */
  29. public function isPublic()
  30. {
  31. return $this->public;
  32. }
  33. /**
  34. * Sets if this Alias is public.
  35. *
  36. * @param bool $boolean If this Alias should be public
  37. */
  38. public function setPublic($boolean)
  39. {
  40. $this->public = (bool) $boolean;
  41. }
  42. /**
  43. * Returns the Id of this alias.
  44. *
  45. * @return string The alias id
  46. */
  47. public function __toString()
  48. {
  49. return $this->id;
  50. }
  51. }