@@ -19,7 +19,7 @@ |
||
19 | 19 | class NotFoundException extends HttpExceptionAbstract |
20 | 20 | { |
21 | 21 | |
22 | - protected $code = 404; |
|
23 | - protected $message = "Not Found"; |
|
22 | + protected $code = 404; |
|
23 | + protected $message = "Not Found"; |
|
24 | 24 | |
25 | 25 | } |
@@ -19,7 +19,7 @@ |
||
19 | 19 | class PaymentRequiredException extends HttpExceptionAbstract |
20 | 20 | { |
21 | 21 | |
22 | - protected $code = 402; |
|
23 | - protected $message = "Payment Required"; |
|
22 | + protected $code = 402; |
|
23 | + protected $message = "Payment Required"; |
|
24 | 24 | |
25 | 25 | } |
@@ -19,7 +19,7 @@ |
||
19 | 19 | class PreconditionFailedException extends HttpExceptionAbstract |
20 | 20 | { |
21 | 21 | |
22 | - protected $code = 412; |
|
23 | - protected $message = "Precondition Failed"; |
|
22 | + protected $code = 412; |
|
23 | + protected $message = "Precondition Failed"; |
|
24 | 24 | |
25 | 25 | } |
@@ -19,7 +19,7 @@ |
||
19 | 19 | class RequestTimeOutException extends HttpExceptionAbstract |
20 | 20 | { |
21 | 21 | |
22 | - protected $code = 408; |
|
23 | - protected $message = "Request Time Out"; |
|
22 | + protected $code = 408; |
|
23 | + protected $message = "Request Time Out"; |
|
24 | 24 | |
25 | 25 | } |
@@ -19,7 +19,7 @@ |
||
19 | 19 | class ServiceUnavailableException extends HttpExceptionAbstract |
20 | 20 | { |
21 | 21 | |
22 | - protected $code = 503; |
|
23 | - protected $message = "Service Unavailable"; |
|
22 | + protected $code = 503; |
|
23 | + protected $message = "Service Unavailable"; |
|
24 | 24 | |
25 | 25 | } |
@@ -19,7 +19,7 @@ |
||
19 | 19 | class UnauthorizedException extends HttpExceptionAbstract |
20 | 20 | { |
21 | 21 | |
22 | - protected $code = 401; |
|
23 | - protected $message = "Unauthorized Exception"; |
|
22 | + protected $code = 401; |
|
23 | + protected $message = "Unauthorized Exception"; |
|
24 | 24 | |
25 | 25 | } |
@@ -19,7 +19,7 @@ |
||
19 | 19 | class UnsupportedMediaTypeException extends HttpExceptionAbstract |
20 | 20 | { |
21 | 21 | |
22 | - protected $code = 415; |
|
23 | - protected $message = "Unsupported Media Type"; |
|
22 | + protected $code = 415; |
|
23 | + protected $message = "Unsupported Media Type"; |
|
24 | 24 | |
25 | 25 | } |
@@ -19,8 +19,8 @@ |
||
19 | 19 | class MethodNotSupportedException extends \Exception |
20 | 20 | { |
21 | 21 | |
22 | - public function __construct($method) { |
|
23 | - $this->message = "The HTTP method '$method' is not supported by the route collector."; |
|
24 | - } |
|
22 | + public function __construct($method) { |
|
23 | + $this->message = "The HTTP method '$method' is not supported by the route collector."; |
|
24 | + } |
|
25 | 25 | |
26 | 26 | } |
@@ -19,227 +19,227 @@ |
||
19 | 19 | class Group |
20 | 20 | { |
21 | 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 | - public function set($route) |
|
38 | - { |
|
39 | - if ($route instanceof Group) { |
|
40 | - foreach ($route->all() as $r) |
|
41 | - $this->routes[] = $r; |
|
42 | - } else $this->routes[] = $route; |
|
43 | - return $this; |
|
44 | - } |
|
45 | - |
|
46 | - /** |
|
47 | - * A fast way to register a route into the group |
|
48 | - * |
|
49 | - * @param Route $route |
|
50 | - * @return self |
|
51 | - */ |
|
52 | - |
|
53 | - public function setRoute(Route $route) |
|
54 | - { |
|
55 | - $this->routes[] = $route; |
|
56 | - return $this; |
|
57 | - } |
|
58 | - |
|
59 | - /** |
|
60 | - * Return all grouped routes objects. |
|
61 | - * |
|
62 | - * @return Route[] |
|
63 | - */ |
|
64 | - |
|
65 | - public function all() |
|
66 | - { |
|
67 | - return $this->routes; |
|
68 | - } |
|
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 | - public function nth($number) |
|
79 | - { |
|
80 | - return $this->routes[$number]; |
|
81 | - } |
|
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 | - public function forget() |
|
92 | - { |
|
93 | - foreach ($this->routes as $route) |
|
94 | - $route->forget(); |
|
95 | - return $this; |
|
96 | - } |
|
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 | - public function setMethod($method) |
|
106 | - { |
|
107 | - foreach ($this->routes as $route) |
|
108 | - $route->setMethod($method); |
|
109 | - return $this; |
|
110 | - } |
|
111 | - |
|
112 | - /** |
|
113 | - * Set one action to all grouped routes. |
|
114 | - * |
|
115 | - * @param string $action |
|
116 | - * @return self |
|
117 | - */ |
|
118 | - |
|
119 | - public function setAction($action) |
|
120 | - { |
|
121 | - foreach ($this->routes as $route) |
|
122 | - $route->setAction($action); |
|
123 | - return $this; |
|
124 | - } |
|
125 | - |
|
126 | - /** |
|
127 | - * Set one namespace to all grouped routes. |
|
128 | - * |
|
129 | - * @param string $namespace |
|
130 | - * @return self |
|
131 | - */ |
|
132 | - |
|
133 | - public function setNamespace($namespace) |
|
134 | - { |
|
135 | - foreach ($this->routes as $route) |
|
136 | - $route->setNamespace($namespace); |
|
137 | - return $this; |
|
138 | - } |
|
139 | - |
|
140 | - /** |
|
141 | - * Add a prefix to all grouped routes pattern. |
|
142 | - * |
|
143 | - * @param string $prefix |
|
144 | - * @return self |
|
145 | - */ |
|
146 | - |
|
147 | - public function setPrefix($prefix) |
|
148 | - { |
|
149 | - $prefix = "/" . ltrim($prefix, "/"); |
|
150 | - foreach ($this->routes as $route) |
|
151 | - $route->setPattern(rtrim($prefix . $route->getPattern(), "/")); |
|
152 | - return $this; |
|
153 | - } |
|
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 | - public function setMetadata($key, $value) |
|
165 | - { |
|
166 | - foreach ($this->routes as $route) |
|
167 | - $route->setMetadata($key, $value); |
|
168 | - return $this; |
|
169 | - } |
|
170 | - |
|
171 | - /** |
|
172 | - * Set a bunch of metadata to all grouped routes. |
|
173 | - * |
|
174 | - * @param mixed[] $metadata |
|
175 | - * @return $this |
|
176 | - */ |
|
177 | - |
|
178 | - public function setMetadataArray(array $metadata) |
|
179 | - { |
|
180 | - foreach ($this->routes as $route) |
|
181 | - $route->setMetadataArray($metadata); |
|
182 | - return $this; |
|
183 | - } |
|
184 | - |
|
185 | - /** |
|
186 | - * Set default parameters to all grouped routes. |
|
187 | - * |
|
188 | - * @param mixed[] $defaults |
|
189 | - * @return $this |
|
190 | - */ |
|
191 | - |
|
192 | - public function setDefaults(array $defaults) |
|
193 | - { |
|
194 | - foreach ($this->routes as $route) |
|
195 | - $route->setDefaults($defaults); |
|
196 | - return $this; |
|
197 | - } |
|
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 | - public function setDefault($key, $value) |
|
209 | - { |
|
210 | - foreach ($this->routes as $route) |
|
211 | - $route->setDefault($key, $value); |
|
212 | - return $this; |
|
213 | - } |
|
214 | - |
|
215 | - /** |
|
216 | - * Set one dispatch strategy to all grouped routes. |
|
217 | - * |
|
218 | - * @param string|Strategies\StrategyInterface $strategy |
|
219 | - * @return self |
|
220 | - */ |
|
221 | - |
|
222 | - public function setStrategy($strategy) |
|
223 | - { |
|
224 | - foreach ($this->routes as $route) |
|
225 | - $route->setStrategy($strategy); |
|
226 | - return $this; |
|
227 | - } |
|
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 | - public function setConstraint($name, $regex) |
|
239 | - { |
|
240 | - foreach ($this->routes as $route) |
|
241 | - $route->setConstraint($name, $regex); |
|
242 | - return $this; |
|
243 | - } |
|
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 | + public function set($route) |
|
38 | + { |
|
39 | + if ($route instanceof Group) { |
|
40 | + foreach ($route->all() as $r) |
|
41 | + $this->routes[] = $r; |
|
42 | + } else $this->routes[] = $route; |
|
43 | + return $this; |
|
44 | + } |
|
45 | + |
|
46 | + /** |
|
47 | + * A fast way to register a route into the group |
|
48 | + * |
|
49 | + * @param Route $route |
|
50 | + * @return self |
|
51 | + */ |
|
52 | + |
|
53 | + public function setRoute(Route $route) |
|
54 | + { |
|
55 | + $this->routes[] = $route; |
|
56 | + return $this; |
|
57 | + } |
|
58 | + |
|
59 | + /** |
|
60 | + * Return all grouped routes objects. |
|
61 | + * |
|
62 | + * @return Route[] |
|
63 | + */ |
|
64 | + |
|
65 | + public function all() |
|
66 | + { |
|
67 | + return $this->routes; |
|
68 | + } |
|
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 | + public function nth($number) |
|
79 | + { |
|
80 | + return $this->routes[$number]; |
|
81 | + } |
|
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 | + public function forget() |
|
92 | + { |
|
93 | + foreach ($this->routes as $route) |
|
94 | + $route->forget(); |
|
95 | + return $this; |
|
96 | + } |
|
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 | + public function setMethod($method) |
|
106 | + { |
|
107 | + foreach ($this->routes as $route) |
|
108 | + $route->setMethod($method); |
|
109 | + return $this; |
|
110 | + } |
|
111 | + |
|
112 | + /** |
|
113 | + * Set one action to all grouped routes. |
|
114 | + * |
|
115 | + * @param string $action |
|
116 | + * @return self |
|
117 | + */ |
|
118 | + |
|
119 | + public function setAction($action) |
|
120 | + { |
|
121 | + foreach ($this->routes as $route) |
|
122 | + $route->setAction($action); |
|
123 | + return $this; |
|
124 | + } |
|
125 | + |
|
126 | + /** |
|
127 | + * Set one namespace to all grouped routes. |
|
128 | + * |
|
129 | + * @param string $namespace |
|
130 | + * @return self |
|
131 | + */ |
|
132 | + |
|
133 | + public function setNamespace($namespace) |
|
134 | + { |
|
135 | + foreach ($this->routes as $route) |
|
136 | + $route->setNamespace($namespace); |
|
137 | + return $this; |
|
138 | + } |
|
139 | + |
|
140 | + /** |
|
141 | + * Add a prefix to all grouped routes pattern. |
|
142 | + * |
|
143 | + * @param string $prefix |
|
144 | + * @return self |
|
145 | + */ |
|
146 | + |
|
147 | + public function setPrefix($prefix) |
|
148 | + { |
|
149 | + $prefix = "/" . ltrim($prefix, "/"); |
|
150 | + foreach ($this->routes as $route) |
|
151 | + $route->setPattern(rtrim($prefix . $route->getPattern(), "/")); |
|
152 | + return $this; |
|
153 | + } |
|
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 | + public function setMetadata($key, $value) |
|
165 | + { |
|
166 | + foreach ($this->routes as $route) |
|
167 | + $route->setMetadata($key, $value); |
|
168 | + return $this; |
|
169 | + } |
|
170 | + |
|
171 | + /** |
|
172 | + * Set a bunch of metadata to all grouped routes. |
|
173 | + * |
|
174 | + * @param mixed[] $metadata |
|
175 | + * @return $this |
|
176 | + */ |
|
177 | + |
|
178 | + public function setMetadataArray(array $metadata) |
|
179 | + { |
|
180 | + foreach ($this->routes as $route) |
|
181 | + $route->setMetadataArray($metadata); |
|
182 | + return $this; |
|
183 | + } |
|
184 | + |
|
185 | + /** |
|
186 | + * Set default parameters to all grouped routes. |
|
187 | + * |
|
188 | + * @param mixed[] $defaults |
|
189 | + * @return $this |
|
190 | + */ |
|
191 | + |
|
192 | + public function setDefaults(array $defaults) |
|
193 | + { |
|
194 | + foreach ($this->routes as $route) |
|
195 | + $route->setDefaults($defaults); |
|
196 | + return $this; |
|
197 | + } |
|
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 | + public function setDefault($key, $value) |
|
209 | + { |
|
210 | + foreach ($this->routes as $route) |
|
211 | + $route->setDefault($key, $value); |
|
212 | + return $this; |
|
213 | + } |
|
214 | + |
|
215 | + /** |
|
216 | + * Set one dispatch strategy to all grouped routes. |
|
217 | + * |
|
218 | + * @param string|Strategies\StrategyInterface $strategy |
|
219 | + * @return self |
|
220 | + */ |
|
221 | + |
|
222 | + public function setStrategy($strategy) |
|
223 | + { |
|
224 | + foreach ($this->routes as $route) |
|
225 | + $route->setStrategy($strategy); |
|
226 | + return $this; |
|
227 | + } |
|
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 | + public function setConstraint($name, $regex) |
|
239 | + { |
|
240 | + foreach ($this->routes as $route) |
|
241 | + $route->setConstraint($name, $regex); |
|
242 | + return $this; |
|
243 | + } |
|
244 | 244 | |
245 | 245 | } |