We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
1 | <?php |
||
7 | class CrudRouter |
||
8 | { |
||
9 | protected $extraRoutes = []; |
||
10 | |||
11 | protected $name = null; |
||
12 | protected $options = null; |
||
13 | protected $controller = null; |
||
14 | |||
15 | public function __construct($name, $controller, $options) |
||
16 | { |
||
17 | $this->name = $name; |
||
18 | $this->controller = $controller; |
||
19 | $this->options = $options; |
||
20 | |||
21 | // CRUD routes for core features |
||
22 | Route::post($this->name.'/search', [ |
||
23 | 'as' => 'crud.'.$this->name.'.search', |
||
24 | 'uses' => $this->controller.'@search', |
||
25 | ]); |
||
26 | |||
27 | Route::get($this->name.'/reorder', [ |
||
28 | 'as' => 'crud.'.$this->name.'.reorder', |
||
29 | 'uses' => $this->controller.'@reorder', |
||
30 | ]); |
||
31 | |||
32 | Route::post($this->name.'/reorder', [ |
||
33 | 'as' => 'crud.'.$this->name.'.save.reorder', |
||
34 | 'uses' => $this->controller.'@saveReorder', |
||
35 | ]); |
||
36 | |||
37 | Route::get($this->name.'/{id}/details', [ |
||
38 | 'as' => 'crud.'.$this->name.'.showDetailsRow', |
||
39 | 'uses' => $this->controller.'@showDetailsRow', |
||
40 | ]); |
||
41 | |||
42 | Route::get($this->name.'/{id}/translate/{lang}', [ |
||
43 | 'as' => 'crud.'.$this->name.'.translateItem', |
||
44 | 'uses' => $this->controller.'@translateItem', |
||
45 | ]); |
||
46 | |||
47 | Route::get($this->name.'/{id}/revisions', [ |
||
48 | 'as' => 'crud.'.$this->name.'.listRevisions', |
||
49 | 'uses' => $this->controller.'@listRevisions', |
||
50 | ]); |
||
51 | |||
52 | Route::post($this->name.'/{id}/revisions/{revisionId}/restore', [ |
||
53 | 'as' => 'crud.'.$this->name.'.restoreRevision', |
||
54 | 'uses' => $this->controller.'@restoreRevision', |
||
55 | ]); |
||
56 | } |
||
57 | |||
58 | /** |
||
59 | * The CRUD resource needs to be registered after all the other routes. |
||
60 | */ |
||
61 | public function __destruct() |
||
77 | |||
78 | /** |
||
79 | * Call other methods in this class, that register extra routes. |
||
80 | * |
||
81 | * @param [type] $injectables [description] |
||
|
|||
82 | * @return [type] [description] |
||
83 | */ |
||
84 | public function with($injectables) |
||
85 | { |
||
86 | if (is_string($injectables)) { |
||
87 | $this->extraRoutes[] = 'with'.ucwords($injectables); |
||
88 | } elseif (is_array($injectables)) { |
||
89 | foreach ($injectables as $injectable) { |
||
90 | $this->extraRoutes[] = 'with'.ucwords($injectable); |
||
91 | } |
||
92 | } else { |
||
93 | $reflection = new \ReflectionFunction($injectables); |
||
94 | |||
95 | if ($reflection->isClosure()) { |
||
96 | $this->extraRoutes[] = $injectables; |
||
97 | } |
||
98 | } |
||
99 | |||
100 | return $this->registerExtraRoutes(); |
||
101 | } |
||
102 | |||
103 | /** |
||
104 | * TODO |
||
105 | * Give developers the ability to unregister a route. |
||
106 | */ |
||
107 | // public function without($injectables) {} |
||
108 | |||
109 | /** |
||
110 | * Register the routes that were passed using the "with" syntax. |
||
111 | */ |
||
112 | private function registerExtraRoutes() |
||
122 | |||
123 | public function __call($method, $parameters = null) |
||
129 | } |
||
130 |
This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.