| Total Lines | 51 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 11 | interface RouterInterface |
||
| 12 | { |
||
| 13 | const URI_SEPARATOR = '/'; |
||
| 14 | const REQUEST_URI = 'REQUEST_URI'; |
||
| 15 | |||
| 16 | /** |
||
| 17 | * instanciate |
||
| 18 | * |
||
| 19 | * @param RoutesInterface $routes |
||
| 20 | * @param RequestInterface $request |
||
| 21 | */ |
||
| 22 | public function __construct(RoutesInterface $routes, RequestInterface $request); |
||
| 23 | |||
| 24 | /** |
||
| 25 | * assign routes to router |
||
| 26 | * |
||
| 27 | * @param RoutesInterface $routes |
||
| 28 | * @return RouterInterface |
||
| 29 | */ |
||
| 30 | public function setRoutes(RoutesInterface $routes): RouterInterface; |
||
| 31 | |||
| 32 | /** |
||
| 33 | * compiles routes |
||
| 34 | * |
||
| 35 | * @return array |
||
| 36 | */ |
||
| 37 | public function compile(): array; |
||
| 38 | |||
| 39 | /** |
||
| 40 | * return slugs params |
||
| 41 | * |
||
| 42 | * @return array |
||
| 43 | */ |
||
| 44 | public function getParams(): array; |
||
| 45 | |||
| 46 | /** |
||
| 47 | * set params from slugs |
||
| 48 | * |
||
| 49 | * @param RouteInterface $route |
||
| 50 | * @param array $matches |
||
| 51 | * @return RouterInterface |
||
| 52 | */ |
||
| 53 | public function setParams(RouteInterface $route, array $matches): RouterInterface; |
||
| 54 | |||
| 55 | /** |
||
| 56 | * return matching regexp pattern |
||
| 57 | * |
||
| 58 | * @return string |
||
| 59 | */ |
||
| 60 | public function getMatchingRoute(): string; |
||
| 61 | } |
||
| 62 |
For interface and abstract methods, it is impossible to infer the return type from the immediate code. In these cases, it is generally advisible to explicitly annotate these methods with a
@returndoc comment to communicate to implementors of these methods what they are expected to return.