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 | 47 | 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) |
|
154 | |||
155 | /** |
||
156 | * Set metadata to all grouped routes. |
||
157 | * |
||
158 | * @param string $key |
||
159 | * @param string $value |
||
160 | * |
||
161 | * @return $this |
||
162 | */ |
||
163 | |||
164 | 1 | public function setMetadata($key, $value) |
|
170 | |||
171 | /** |
||
172 | * Set a bunch of metadata to all grouped routes. |
||
173 | * |
||
174 | * @param mixed[] $metadata |
||
175 | * @return $this |
||
176 | */ |
||
177 | |||
178 | 1 | public function setMetadataArray(array $metadata) |
|
184 | |||
185 | /** |
||
186 | * Set default parameters to all grouped routes. |
||
187 | * |
||
188 | * @param mixed[] $defaults |
||
189 | * @return $this |
||
190 | */ |
||
191 | |||
192 | 1 | public function setDefaults(array $defaults) |
|
198 | |||
199 | /** |
||
200 | * Set a default parameter to all grouped routes. |
||
201 | * |
||
202 | * @param string $key |
||
203 | * @param mixed $value |
||
204 | * |
||
205 | * @return $this |
||
206 | */ |
||
207 | |||
208 | 1 | public function setDefault($key, $value) |
|
214 | |||
215 | /** |
||
216 | * Set one dispatch strategy to all grouped routes. |
||
217 | * |
||
218 | * @param string|Strategies\StrategyInterface $strategy |
||
219 | * @return self |
||
220 | */ |
||
221 | |||
222 | 12 | public function setStrategy($strategy) |
|
228 | |||
229 | /** |
||
230 | * Replace or define a constraint for all dynamic segments named by $name. |
||
231 | * |
||
232 | * @param string $name |
||
233 | * @param string $regex |
||
234 | * |
||
235 | * @return self |
||
236 | */ |
||
237 | |||
238 | 1 | public function setConstraint($name, $regex) |
|
244 | |||
245 | } |
||
246 |