1 | <?php |
||
12 | class RouteInfo implements Arrayable, JsonSerializable |
||
13 | { |
||
14 | /** |
||
15 | * @var \ReflectionClass|null |
||
16 | */ |
||
17 | protected $routeReflection = null; |
||
18 | |||
19 | /** |
||
20 | * @var \ReflectionFunctionAbstract|null |
||
21 | */ |
||
22 | protected $actionReflection = null; |
||
23 | |||
24 | /** |
||
25 | * @var array |
||
26 | */ |
||
27 | protected $options = []; |
||
28 | |||
29 | /** |
||
30 | * @var array |
||
31 | */ |
||
32 | protected $errors = []; |
||
33 | |||
34 | /** |
||
35 | * @var bool |
||
36 | */ |
||
37 | protected $addMeta; |
||
38 | |||
39 | /** |
||
40 | * @var \Illuminate\Routing\Route |
||
41 | */ |
||
42 | private $route; |
||
43 | |||
44 | public function __construct($route, $options = []) |
||
50 | |||
51 | /** |
||
52 | * @return array |
||
53 | */ |
||
54 | public function toArray() |
||
66 | |||
67 | /** |
||
68 | * Cross version get methods. |
||
69 | * |
||
70 | * @return array |
||
71 | */ |
||
72 | private function getMethods() |
||
80 | |||
81 | protected function extractWheres() |
||
95 | |||
96 | /** |
||
97 | * @return array |
||
98 | */ |
||
99 | function jsonSerialize() |
||
103 | |||
104 | /** |
||
105 | * @return string |
||
106 | */ |
||
107 | protected function extractDocBlocks() |
||
117 | |||
118 | protected function extractFormRequest() |
||
160 | |||
161 | /** |
||
162 | * @return \ReflectionClass |
||
163 | */ |
||
164 | protected function getRouteReflection() |
||
172 | |||
173 | /** |
||
174 | * @return \ReflectionFunctionAbstract|null |
||
175 | */ |
||
176 | protected function getActionReflection() |
||
215 | |||
216 | protected function preparePath() |
||
225 | |||
226 | /** |
||
227 | * Backwards compatible uri getter. |
||
228 | * |
||
229 | * @return string |
||
230 | */ |
||
231 | protected function getUri() |
||
232 | { |
||
233 | $isOldLaravel = method_exists($this->route, 'getPath'); |
||
234 | // <5.4 got `getPath`, 5.4+ got `uri`. |
||
235 | $methodName = $isOldLaravel ? 'getPath' : 'uri'; |
||
236 | |||
237 | return $this->route->$methodName(); |
||
238 | } |
||
239 | |||
240 | protected function setError($type, $text, $params = []) |
||
244 | |||
245 | /** |
||
246 | * @return array |
||
247 | */ |
||
248 | protected function getMeta() |
||
260 | } |
||
261 |
Adding explicit visibility (
private
,protected
, orpublic
) is generally recommend to communicate to other developers how, and from where this method is intended to be used.