| Total Complexity | 8 |
| Total Lines | 42 |
| Duplicated Lines | 0 % |
| Changes | 11 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 5 | trait Helper |
||
| 6 | { |
||
| 7 | protected array $routes = []; |
||
| 8 | protected static Router $instance; |
||
| 9 | protected string $host = ''; |
||
| 10 | |||
| 11 | public static function getInstance(): RouterInterface |
||
| 12 | { |
||
| 13 | self::$instance = (!isset(self::$instance)) ? new Router() : self::$instance; |
||
| 14 | return self::$instance; |
||
| 15 | } |
||
| 16 | |||
| 17 | protected static function updateRoute(array $route, $key): RouterInterface |
||
| 18 | { |
||
| 19 | self::getInstance()->getRoutes()[$key] = $route; |
||
| 20 | return self::getInstance(); |
||
| 21 | } |
||
| 22 | |||
| 23 | public static function defineHost(string $host): Router |
||
| 24 | { |
||
| 25 | self::getInstance()->host = $host; |
||
|
|
|||
| 26 | return self::getInstance(); |
||
| 27 | } |
||
| 28 | |||
| 29 | protected function inSave(): array |
||
| 32 | } |
||
| 33 | |||
| 34 | protected function getHost(): string |
||
| 35 | { |
||
| 36 | return $this->host; |
||
| 37 | } |
||
| 38 | |||
| 39 | protected function getRoutes(): array |
||
| 42 | } |
||
| 43 | |||
| 44 | protected function setRoutes(array $routes): void |
||
| 47 | } |
||
| 48 | |||
| 49 | } |
||
| 50 |