Alias.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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. * Constructor.
  17. *
  18. * @param string $id Alias identifier
  19. * @param bool $public If this alias is public
  20. */
  21. public function __construct($id, $public = true)
  22. {
  23. $this->id = strtolower($id);
  24. $this->public = $public;
  25. }
  26. /**
  27. * Checks if this DI Alias should be public or not.
  28. *
  29. * @return bool
  30. */
  31. public function isPublic()
  32. {
  33. return $this->public;
  34. }
  35. /**
  36. * Sets if this Alias is public.
  37. *
  38. * @param bool $boolean If this Alias should be public
  39. */
  40. public function setPublic($boolean)
  41. {
  42. $this->public = (bool) $boolean;
  43. }
  44. /**
  45. * Returns the Id of this alias.
  46. *
  47. * @return string The alias id
  48. */
  49. public function __toString()
  50. {
  51. return $this->id;
  52. }
  53. }