1 | <?php |
||
19 | class Group |
||
20 | { |
||
21 | |||
22 | /** |
||
23 | * All grouped route objects. |
||
24 | * |
||
25 | * @var Route[] |
||
26 | */ |
||
27 | |||
28 | protected $routes; |
||
29 | |||
30 | /** |
||
31 | * Set a new Route or merge an existing group of routes. |
||
32 | * |
||
33 | * @param Group|Route $route |
||
34 | * @return self |
||
35 | */ |
||
36 | |||
37 | 28 | public function set($route) |
|
45 | |||
46 | /** |
||
47 | * A fast way to register a route into the group |
||
48 | * |
||
49 | * @param Route $route |
||
50 | * @return self |
||
51 | */ |
||
52 | |||
53 | 53 | public function setRoute(Route $route) |
|
58 | |||
59 | /** |
||
60 | * Return all grouped routes objects. |
||
61 | * |
||
62 | * @return Route[] |
||
63 | */ |
||
64 | |||
65 | 28 | public function all() |
|
69 | |||
70 | /** |
||
71 | * Get a specific route of the group, routes receive a key based on |
||
72 | * the order they are added to the group. |
||
73 | * |
||
74 | * @param int $number |
||
75 | * @return Route |
||
76 | */ |
||
77 | |||
78 | 4 | public function nth($number) |
|
82 | |||
83 | /** |
||
84 | * Forget the registration of all grouped routes on to collector. |
||
85 | * After the forget the route object will still exist but will not |
||
86 | * count for the matcher. |
||
87 | * |
||
88 | * @return self |
||
89 | */ |
||
90 | |||
91 | 3 | public function forget() |
|
97 | |||
98 | /** |
||
99 | * Set one HTTP method to all grouped routes. |
||
100 | * |
||
101 | * @param string $method The HTTP Method |
||
102 | * @return self |
||
103 | */ |
||
104 | |||
105 | 1 | public function setMethod($method) |
|
111 | |||
112 | /** |
||
113 | * Set one action to all grouped routes. |
||
114 | * |
||
115 | * @param string $action |
||
116 | * @return self |
||
117 | */ |
||
118 | |||
119 | 3 | public function setAction($action) |
|
125 | |||
126 | /** |
||
127 | * Set one namespace to all grouped routes. |
||
128 | * |
||
129 | * @param string $namespace |
||
130 | * @return self |
||
131 | */ |
||
132 | |||
133 | 1 | public function setNamespace($namespace) |
|
139 | |||
140 | /** |
||
141 | * Add a prefix to all grouped routes pattern. |
||
142 | * |
||
143 | * @param string $prefix |
||
144 | * @return self |
||
145 | */ |
||
146 | |||
147 | 3 | public function setPrefix($prefix) |
|
156 | |||
157 | /** |
||
158 | * Set metadata to all grouped routes. |
||
159 | * |
||
160 | * @param string $key |
||
161 | * @param string $value |
||
162 | * |
||
163 | * @return $this |
||
164 | */ |
||
165 | |||
166 | 1 | public function setMetadata($key, $value) |
|
172 | |||
173 | /** |
||
174 | * Set a bunch of metadata to all grouped routes. |
||
175 | * |
||
176 | * @param mixed[] $metadata |
||
177 | * @return $this |
||
178 | */ |
||
179 | |||
180 | 1 | public function setMetadataArray(array $metadata) |
|
186 | |||
187 | /** |
||
188 | * Set default parameters to all grouped routes. |
||
189 | * |
||
190 | * @param mixed[] $defaults |
||
191 | * @return $this |
||
192 | */ |
||
193 | |||
194 | 1 | public function setDefaults(array $defaults) |
|
200 | |||
201 | /** |
||
202 | * Set a default parameter to all grouped routes. |
||
203 | * |
||
204 | * @param string $key |
||
205 | * @param mixed $value |
||
206 | * |
||
207 | * @return $this |
||
208 | */ |
||
209 | |||
210 | 1 | public function setDefault($key, $value) |
|
216 | |||
217 | /** |
||
218 | * Set one dispatch strategy to all grouped routes. |
||
219 | * |
||
220 | * @param string|Strategies\StrategyInterface $strategy |
||
221 | * @return self |
||
222 | */ |
||
223 | |||
224 | 16 | public function setStrategy($strategy) |
|
230 | |||
231 | /** |
||
232 | * Replace or define a constraint for all dynamic segments named by $name. |
||
233 | * |
||
234 | * @param string $name |
||
235 | * @param string $regex |
||
236 | * |
||
237 | * @return self |
||
238 | */ |
||
239 | |||
240 | 1 | public function setConstraint($name, $regex) |
|
246 | |||
247 | } |
||
248 |