vendor/symfony/src/Symfony/Component/DependencyInjection/Alias.php
changeset 0 7f95f8617b0b
equal deleted inserted replaced
-1:000000000000 0:7f95f8617b0b
       
     1 <?php
       
     2 
       
     3 /*
       
     4  * This file is part of the Symfony package.
       
     5  *
       
     6  * (c) Fabien Potencier <fabien@symfony.com>
       
     7  *
       
     8  * For the full copyright and license information, please view the LICENSE
       
     9  * file that was distributed with this source code.
       
    10  */
       
    11 
       
    12 namespace Symfony\Component\DependencyInjection;
       
    13 
       
    14 /**
       
    15  * @api
       
    16  */
       
    17 class Alias
       
    18 {
       
    19     private $id;
       
    20     private $public;
       
    21 
       
    22     /**
       
    23      * Constructor.
       
    24      *
       
    25      * @param string $id Alias identifier
       
    26      * @param Boolean $public If this alias is public
       
    27      *
       
    28      * @api
       
    29      */
       
    30     public function __construct($id, $public = true)
       
    31     {
       
    32         $this->id = strtolower($id);
       
    33         $this->public = $public;
       
    34     }
       
    35 
       
    36     /**
       
    37      * Checks if this DI Alias should be public or not.
       
    38      *
       
    39      * @return Boolean
       
    40      *
       
    41      * @api
       
    42      */
       
    43     public function isPublic()
       
    44     {
       
    45         return $this->public;
       
    46     }
       
    47 
       
    48     /**
       
    49      * Sets if this Alias is public.
       
    50      *
       
    51      * @param Boolean $boolean If this Alias should be public
       
    52      *
       
    53      * @api
       
    54      */
       
    55     public function setPublic($boolean)
       
    56     {
       
    57         $this->public = (Boolean) $boolean;
       
    58     }
       
    59 
       
    60     /**
       
    61      * Returns the Id of this alias.
       
    62      *
       
    63      * @return string The alias id
       
    64      *
       
    65      * @api
       
    66      */
       
    67     public function __toString()
       
    68     {
       
    69         return $this->id;
       
    70     }
       
    71 }