1 | <?php namespace MaartenStaa\Routing; |
||
42 | class Router extends LaravelRouter |
||
43 | { |
||
44 | /** |
||
45 | * Version of the cache key |
||
46 | * |
||
47 | * @var string |
||
48 | */ |
||
49 | protected $cacheVersion = 'v1'; |
||
50 | |||
51 | /** |
||
52 | * Create a new Router instance. |
||
53 | * |
||
54 | * @param \Illuminate\Events\Dispatcher $events |
||
55 | * @param \Illuminate\Container\Container|null $container |
||
56 | */ |
||
57 | 44 | public function __construct(Dispatcher $events, Container $container = null) |
|
63 | |||
64 | /** |
||
65 | * Indicate that the routes that are defined in the given callback |
||
66 | * should be cached. |
||
67 | * |
||
68 | * @param string $filename |
||
69 | * @param Closure $callback |
||
70 | * @param int $cacheMinutes |
||
71 | * @return string |
||
|
|||
72 | */ |
||
73 | 36 | public function cache($filename, Closure $callback, $cacheMinutes = 1440) |
|
107 | |||
108 | /** |
||
109 | * Clear the cached data for the given routes file. |
||
110 | * |
||
111 | * @param string $filename |
||
112 | */ |
||
113 | 4 | public function clearCache($filename) |
|
119 | |||
120 | /** |
||
121 | * Get the key under which the routes cache for the given file should be stored. |
||
122 | * |
||
123 | * @param string $filename |
||
124 | * @return string |
||
125 | */ |
||
126 | 32 | protected function getCacheKey($filename) |
|
130 | |||
131 | /** |
||
132 | * Determine if the action is routing to a controller. |
||
133 | * |
||
134 | * @param array $action |
||
135 | * @return bool |
||
136 | */ |
||
137 | 44 | public function routingToController($action) |
|
141 | |||
142 | /** |
||
143 | * Add a controller based route action to the action array. |
||
144 | * |
||
145 | * @param array|string $action |
||
146 | * @return array |
||
147 | */ |
||
148 | 36 | protected function getControllerAction($action) |
|
170 | |||
171 | /** |
||
172 | * Replace the string action in the given array with a Closure to call. |
||
173 | * |
||
174 | * @param array $action |
||
175 | * @return array |
||
176 | */ |
||
177 | 8 | public function makeControllerActionClosure(array $action) |
|
183 | |||
184 | /** |
||
185 | * Create a new route instance. |
||
186 | * |
||
187 | * @param array|string $methods |
||
188 | * @param string $uri |
||
189 | * @param mixed $action |
||
190 | * @return \Illuminate\Routing\Route |
||
191 | */ |
||
192 | 44 | protected function createRoute($methods, $uri, $action) |
|
218 | |||
219 | /** |
||
220 | * Create a new Route object. |
||
221 | * |
||
222 | * @param array|string $methods |
||
223 | * @param string $uri |
||
224 | * @param mixed $action |
||
225 | * @return \Illuminate\Routing\Route |
||
226 | */ |
||
227 | 44 | protected function newRoute($methods, $uri, $action) |
|
231 | |||
232 | /** |
||
233 | * Add the necessary where clauses to the route based on its initial registration. |
||
234 | * |
||
235 | * @param \Illuminate\Routing\Route $route |
||
236 | * @return \Illuminate\Routing\Route |
||
237 | */ |
||
238 | 44 | protected function addWhereClausesToRoute($route) |
|
245 | } |
||
246 |
This check compares the return type specified in the
@return
annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.