Total Complexity | 5 |
Total Lines | 39 |
Duplicated Lines | 0 % |
Changes | 3 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
13 | class Router |
||
14 | { |
||
15 | /** @var string[] */ |
||
16 | protected static $routes = []; |
||
17 | |||
18 | /** |
||
19 | * Adiciona as rotas |
||
20 | * @param string $namespace |
||
21 | * @param string[] $routes |
||
22 | */ |
||
23 | public static function add($namespace, $routes) |
||
24 | { |
||
25 | foreach ($routes as $request => $destination) { |
||
26 | static::$routes[$request] = $namespace . $destination; |
||
27 | } |
||
28 | } |
||
29 | |||
30 | /** |
||
31 | * Percorre todas as rotas e retorna o destino final |
||
32 | * @return array Destino |
||
33 | * @example return [Controller, action, [..$args]] |
||
34 | */ |
||
35 | public static function getDestination() |
||
52 | } |
||
53 | } |
||
54 |