]>
Commit | Line | Data |
---|---|---|
4f5b44bd NL |
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 $variables; | |
22 | private $tokens; | |
23 | private $staticPrefix; | |
24 | private $regex; | |
25 | private $pathVariables; | |
26 | private $hostVariables; | |
27 | private $hostRegex; | |
28 | private $hostTokens; | |
29 | ||
30 | /** | |
31 | * Constructor. | |
32 | * | |
33 | * @param string $staticPrefix The static prefix of the compiled route | |
34 | * @param string $regex The regular expression to use to match this route | |
35 | * @param array $tokens An array of tokens to use to generate URL for this route | |
36 | * @param array $pathVariables An array of path variables | |
37 | * @param string|null $hostRegex Host regex | |
38 | * @param array $hostTokens Host tokens | |
39 | * @param array $hostVariables An array of host variables | |
40 | * @param array $variables An array of variables (variables defined in the path and in the host patterns) | |
41 | */ | |
42 | public function __construct($staticPrefix, $regex, array $tokens, array $pathVariables, $hostRegex = null, array $hostTokens = array(), array $hostVariables = array(), array $variables = array()) | |
43 | { | |
44 | $this->staticPrefix = (string) $staticPrefix; | |
45 | $this->regex = $regex; | |
46 | $this->tokens = $tokens; | |
47 | $this->pathVariables = $pathVariables; | |
48 | $this->hostRegex = $hostRegex; | |
49 | $this->hostTokens = $hostTokens; | |
50 | $this->hostVariables = $hostVariables; | |
51 | $this->variables = $variables; | |
52 | } | |
53 | ||
54 | /** | |
55 | * Returns the static prefix. | |
56 | * | |
57 | * @return string The static prefix | |
58 | */ | |
59 | public function getStaticPrefix() | |
60 | { | |
61 | return $this->staticPrefix; | |
62 | } | |
63 | ||
64 | /** | |
65 | * Returns the regex. | |
66 | * | |
67 | * @return string The regex | |
68 | */ | |
69 | public function getRegex() | |
70 | { | |
71 | return $this->regex; | |
72 | } | |
73 | ||
74 | /** | |
75 | * Returns the host regex | |
76 | * | |
77 | * @return string|null The host regex or null | |
78 | */ | |
79 | public function getHostRegex() | |
80 | { | |
81 | return $this->hostRegex; | |
82 | } | |
83 | ||
84 | /** | |
85 | * Returns the tokens. | |
86 | * | |
87 | * @return array The tokens | |
88 | */ | |
89 | public function getTokens() | |
90 | { | |
91 | return $this->tokens; | |
92 | } | |
93 | ||
94 | /** | |
95 | * Returns the host tokens. | |
96 | * | |
97 | * @return array The tokens | |
98 | */ | |
99 | public function getHostTokens() | |
100 | { | |
101 | return $this->hostTokens; | |
102 | } | |
103 | ||
104 | /** | |
105 | * Returns the variables. | |
106 | * | |
107 | * @return array The variables | |
108 | */ | |
109 | public function getVariables() | |
110 | { | |
111 | return $this->variables; | |
112 | } | |
113 | ||
114 | /** | |
115 | * Returns the path variables. | |
116 | * | |
117 | * @return array The variables | |
118 | */ | |
119 | public function getPathVariables() | |
120 | { | |
121 | return $this->pathVariables; | |
122 | } | |
123 | ||
124 | /** | |
125 | * Returns the host variables. | |
126 | * | |
127 | * @return array The variables | |
128 | */ | |
129 | public function getHostVariables() | |
130 | { | |
131 | return $this->hostVariables; | |
132 | } | |
133 | ||
134 | } |