| Total Complexity | 6 |
| Total Lines | 26 |
| Duplicated Lines | 0 % |
| Coverage | 72.72% |
| Changes | 0 | ||
| 1 | <?php |
||
| 5 | class RouteCollection |
||
| 6 | { |
||
| 7 | protected $routes = []; |
||
| 8 | |||
| 9 | 7 | public function add(string $name, RouteDefinition $route) |
|
| 10 | { |
||
| 11 | 7 | if (!isset($this->routes['$name'])) { |
|
| 12 | 7 | $this->routes[$name] = $route; |
|
| 13 | 7 | return true; |
|
| 14 | } |
||
| 15 | throw new \InvalidArgumentException("The route {$name} already exists."); |
||
| 16 | } |
||
| 17 | |||
| 18 | public function get($name) |
||
| 21 | } |
||
| 22 | |||
| 23 | 5 | public function all() |
|
| 26 | } |
||
| 27 | |||
| 28 | 2 | public function count() |
|
| 33 |