1 | <?php |
||
6 | class Regex implements RouteFileParser { |
||
7 | |||
8 | const |
||
9 | VERB = 0, |
||
10 | URI = 1, |
||
11 | REGEX_PREFIX = '~^(?:', |
||
12 | REGEX_SEPARATOR = '|', |
||
13 | REGEX_AFFIX = ')$~'; |
||
14 | |||
15 | /** |
||
16 | * Parses the passed route file and return a specialized array |
||
17 | * |
||
18 | * @param string $file Absolute path to the route file |
||
19 | * @throws \Exception If $file is missing or empty |
||
20 | * @return Array Lookup table for routes and a combined regex |
||
21 | */ |
||
22 | 11 | public function digest($file) |
|
38 | |||
39 | /** |
||
40 | * Gets the routes data and returns it |
||
41 | * |
||
42 | * @param $file |
||
43 | * @throws \Exception If $file is missing or empty |
||
44 | */ |
||
45 | 11 | private function getRoutesData($file) { |
|
56 | |||
57 | /** |
||
58 | * Sets the group regex string with the constant REGEX_PREFIX between each route |
||
59 | * |
||
60 | * @param array &$routeRegexes |
||
61 | * @param array &$routesData |
||
62 | * @param int $index |
||
63 | */ |
||
64 | 9 | private function setRouteRegexData(&$routeRegexes, &$routesData, $index) { |
|
69 | } |