Total Complexity | 3 |
Total Lines | 24 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php declare(strict_types=1); |
||
8 | class Std implements ReverserDataGenerator |
||
9 | { |
||
10 | protected $routes = []; |
||
11 | |||
12 | /** |
||
13 | * @inheritDoc |
||
14 | */ |
||
15 | 11 | public function addRoute(string $routeName, $routeData): void |
|
16 | { |
||
17 | 11 | if (isset($this->routes[$routeName])) { |
|
18 | 1 | throw new BadRouteException(sprintf( |
|
19 | 1 | 'Cannot register two routes with same name "%s"', |
|
20 | 1 | $routeName |
|
21 | )); |
||
22 | } |
||
23 | 11 | $this->routes[$routeName] = $routeData; |
|
24 | 11 | } |
|
25 | |||
26 | /** |
||
27 | * @inheritDoc |
||
28 | */ |
||
29 | 15 | public function getData(): array |
|
32 | } |
||
33 | } |
||
34 |