Conditions | 4 |
Paths | 2 |
Total Lines | 13 |
Code Lines | 5 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
11 | public function __construct(Request $request) |
||
12 | { |
||
13 | $res = explode('::', $request->target()); |
||
14 | |||
15 | // if explode() returned false |
||
16 | // or if the array doesn't have a second element (the method) |
||
17 | // or if the array has more than 2 elements |
||
18 | if ($res === false || !isset($res[1]) || isset($res[2])) { |
||
19 | throw new RouterException('INVALID_TARGET_FORMAT'); |
||
20 | } |
||
21 | |||
22 | $this->controller = $res[0]; |
||
23 | $this->method = $res[1]; |
||
24 | } |
||
36 | ?> |
||
|
Using a closing tag in PHP files that only contain PHP code is not recommended as you might accidentally add whitespace after the closing tag which would then be output by PHP. This can cause severe problems, for example headers cannot be sent anymore.
A simple precaution is to leave off the closing tag as it is not required, and it also has no negative effects whatsoever.