vendor/symfony/src/Symfony/Component/Routing/CompiledRoute.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\Routing;
       
    13 
       
    14 /**
       
    15  * CompiledRoutes are returned by the RouteCompiler class.
       
    16  *
       
    17  * @author Fabien Potencier <fabien@symfony.com>
       
    18  */
       
    19 class CompiledRoute
       
    20 {
       
    21     private $route;
       
    22     private $variables;
       
    23     private $tokens;
       
    24     private $staticPrefix;
       
    25     private $regex;
       
    26 
       
    27     /**
       
    28      * Constructor.
       
    29      *
       
    30      * @param Route  $route        A original Route instance
       
    31      * @param string $staticPrefix The static prefix of the compiled route
       
    32      * @param string $regex        The regular expression to use to match this route
       
    33      * @param array  $tokens       An array of tokens to use to generate URL for this route
       
    34      * @param array  $variables    An array of variables
       
    35      */
       
    36     public function __construct(Route $route, $staticPrefix, $regex, array $tokens, array $variables)
       
    37     {
       
    38         $this->route = $route;
       
    39         $this->staticPrefix = $staticPrefix;
       
    40         $this->regex = $regex;
       
    41         $this->tokens = $tokens;
       
    42         $this->variables = $variables;
       
    43     }
       
    44 
       
    45     /**
       
    46      * Returns the Route instance.
       
    47      *
       
    48      * @return Route A Route instance
       
    49      */
       
    50     public function getRoute()
       
    51     {
       
    52         return $this->route;
       
    53     }
       
    54 
       
    55     /**
       
    56      * Returns the static prefix.
       
    57      *
       
    58      * @return string The static prefix
       
    59      */
       
    60     public function getStaticPrefix()
       
    61     {
       
    62         return $this->staticPrefix;
       
    63     }
       
    64 
       
    65     /**
       
    66      * Returns the regex.
       
    67      *
       
    68      * @return string The regex
       
    69      */
       
    70     public function getRegex()
       
    71     {
       
    72         return $this->regex;
       
    73     }
       
    74 
       
    75     /**
       
    76      * Returns the tokens.
       
    77      *
       
    78      * @return array The tokens
       
    79      */
       
    80     public function getTokens()
       
    81     {
       
    82         return $this->tokens;
       
    83     }
       
    84 
       
    85     /**
       
    86      * Returns the variables.
       
    87      *
       
    88      * @return array The variables
       
    89      */
       
    90     public function getVariables()
       
    91     {
       
    92         return $this->variables;
       
    93     }
       
    94 
       
    95     /**
       
    96      * Returns the pattern.
       
    97      *
       
    98      * @return string The pattern
       
    99      */
       
   100     public function getPattern()
       
   101     {
       
   102         return $this->route->getPattern();
       
   103     }
       
   104 
       
   105     /**
       
   106      * Returns the options.
       
   107      *
       
   108      * @return array The options
       
   109      */
       
   110     public function getOptions()
       
   111     {
       
   112         return $this->route->getOptions();
       
   113     }
       
   114 
       
   115     /**
       
   116      * Returns the defaults.
       
   117      *
       
   118      * @return array The defaults
       
   119      */
       
   120     public function getDefaults()
       
   121     {
       
   122         return $this->route->getDefaults();
       
   123     }
       
   124 
       
   125     /**
       
   126      * Returns the requirements.
       
   127      *
       
   128      * @return array The requirements
       
   129      */
       
   130     public function getRequirements()
       
   131     {
       
   132         return $this->route->getRequirements();
       
   133     }
       
   134 }