1 | <?php |
||
12 | class RegexDispatcher implements Dispatcher |
||
13 | { |
||
14 | /** |
||
15 | * @var RouteCollector |
||
16 | */ |
||
17 | protected $routeCollector; |
||
18 | |||
19 | /** |
||
20 | * @var null |
||
21 | */ |
||
22 | protected $data; |
||
23 | /** |
||
24 | * @var |
||
25 | */ |
||
26 | protected $path; |
||
27 | |||
28 | /** |
||
29 | * @var array |
||
30 | */ |
||
31 | protected $explodedPath; |
||
32 | |||
33 | /** |
||
34 | * @var |
||
35 | */ |
||
36 | protected $httpMethod; |
||
37 | |||
38 | /** |
||
39 | * @param RouteCollector $routeCollector |
||
40 | * @param null $data |
||
41 | */ |
||
42 | 3 | public function __construct(RouteCollector $routeCollector, $data = null) |
|
47 | |||
48 | /** |
||
49 | * @param $httpMethod |
||
50 | * @param $path |
||
51 | * @return array|mixed |
||
52 | */ |
||
53 | 3 | public function dispatch($httpMethod, $path) |
|
61 | |||
62 | /** |
||
63 | * @param array $data |
||
64 | * @return array |
||
65 | */ |
||
66 | 3 | protected function findDataFromAllRoute(array $data) |
|
81 | |||
82 | /** |
||
83 | * @param Route $route |
||
84 | * @param $countExplodePath |
||
85 | * @param array $result |
||
86 | */ |
||
87 | 3 | protected function findDataByRouteMethodAndRulePath(Route $route, $countExplodePath, array &$result) |
|
97 | |||
98 | /** |
||
99 | * @param Route $route |
||
100 | * @param $countExplodePath |
||
101 | * @param array $result |
||
102 | */ |
||
103 | 3 | protected function findDataByAllMatchesRulePath(Route $route, $countExplodePath, array &$result) |
|
112 | |||
113 | /** |
||
114 | * @param Route $route |
||
115 | * @param $index |
||
116 | * @param array $result |
||
117 | */ |
||
118 | 3 | protected function findDataByMatchesRulePath(Route $route, $index, array &$result) |
|
131 | |||
132 | /** |
||
133 | * @param mixed $path |
||
134 | */ |
||
135 | 3 | public function setPath($path) |
|
141 | |||
142 | /** |
||
143 | * @param $path |
||
144 | * @return string |
||
145 | */ |
||
146 | 3 | public static function normalizePath($path) |
|
151 | |||
152 | /** |
||
153 | * @param $path |
||
154 | * @return array |
||
155 | */ |
||
156 | 3 | public static function explodePath($path) |
|
160 | } |
||
161 |