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 | 3 | ||
33 | /** |
||
34 | 3 | * @var |
|
35 | 3 | */ |
|
36 | 3 | protected $httpMethod; |
|
37 | |||
38 | /** |
||
39 | * @param RouteCollector $routeCollector |
||
40 | * @param null $data |
||
41 | */ |
||
42 | 3 | public function __construct(RouteCollector $routeCollector, $data = null) |
|
47 | 3 | ||
48 | /** |
||
49 | 3 | * @param $httpMethod |
|
50 | 3 | * @param $path |
|
51 | 3 | * @return array|mixed |
|
52 | */ |
||
53 | 3 | public function dispatch($httpMethod, $path) |
|
61 | 3 | ||
62 | 3 | /** |
|
63 | * @param array $data |
||
64 | 3 | * @return array |
|
65 | 3 | */ |
|
66 | 3 | protected function findDataFromAllRoute(array $data) |
|
81 | |||
82 | 3 | /** |
|
83 | 3 | * @param Route $route |
|
84 | 3 | * @param $countExplodePath |
|
85 | 3 | * @param array $result |
|
86 | */ |
||
87 | 3 | protected function findDataByRouteMethodAndRulePath(Route $route, $countExplodePath, array &$result) |
|
97 | |||
98 | 3 | /** |
|
99 | * @param Route $route |
||
100 | 3 | * @param $countExplodePath |
|
101 | 3 | * @param array $result |
|
102 | */ |
||
103 | protected function findDataByAllMatchesRulePath(Route $route, $countExplodePath, array &$result) |
||
112 | |||
113 | /** |
||
114 | * @param Route $route |
||
115 | * @param $index |
||
116 | * @param array $result |
||
117 | 3 | */ |
|
118 | protected function findDataByMatchesRulePath(Route $route, $index, array &$result) |
||
131 | |||
132 | /** |
||
133 | * @param mixed $path |
||
134 | */ |
||
135 | public function setPath($path) |
||
141 | |||
142 | /** |
||
143 | * @param $path |
||
144 | * @return string |
||
145 | */ |
||
146 | public static function normalizePath($path) |
||
151 | |||
152 | /** |
||
153 | * @param $path |
||
154 | * @return array |
||
155 | */ |
||
156 | public static function explodePath($path) |
||
160 | } |
||
161 |