| Conditions | 5 |
| Paths | 8 |
| Total Lines | 16 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| 1 | <?php |
||
| 44 | public function __invoke($uri = null, array $stripParams = null) |
||
|
|
|||
| 45 | { |
||
| 46 | if (is_array($uri)) { |
||
| 47 | $stripParams = $uri; |
||
| 48 | $uri = null; |
||
| 49 | } |
||
| 50 | |||
| 51 | if (null === $uri && isset($_SERVER['REQUEST_URI'])) { |
||
| 52 | $uri = preg_replace('~^' . $this->getView()->basePath() . '~', '', $_SERVER['REQUEST_URI']); |
||
| 53 | } |
||
| 54 | |||
| 55 | if (null === $stripParams) { |
||
| 56 | return $this->getFilter()->filter($uri); |
||
| 57 | } |
||
| 58 | return $this->getFilter()->filter($uri, $stripParams); |
||
| 59 | } |
||
| 60 | } |
||
| 61 |
Instead of super-globals, we recommend to explicitly inject the dependencies of your class. This makes your code less dependent on global state and it becomes generally more testable: