1 | <?php |
||
7 | class DataTables |
||
8 | { |
||
9 | use Macroable; |
||
10 | |||
11 | /** |
||
12 | * DataTables request object. |
||
13 | * |
||
14 | * @var \Yajra\DataTables\Utilities\Request |
||
15 | */ |
||
16 | protected $request; |
||
17 | |||
18 | /** |
||
19 | * HTML builder instance. |
||
20 | * |
||
21 | * @var \Yajra\DataTables\Html\Builder |
||
22 | */ |
||
23 | protected $html; |
||
24 | |||
25 | /** |
||
26 | * Make a DataTable instance from source. |
||
27 | * Alias of make for backward compatibility. |
||
28 | * |
||
29 | * @param mixed $source |
||
30 | * @return mixed |
||
31 | * @throws \Exception |
||
32 | */ |
||
33 | public static function of($source) |
||
37 | |||
38 | /** |
||
39 | * Make a DataTable instance from source. |
||
40 | * |
||
41 | * @param mixed $source |
||
42 | * @return mixed |
||
43 | * @throws \Exception |
||
44 | */ |
||
45 | public static function make($source) |
||
46 | { |
||
47 | $engines = config('datatables.engines'); |
||
48 | $builders = config('datatables.builders'); |
||
49 | |||
50 | $args = func_get_args(); |
||
51 | foreach ($builders as $class => $engine) { |
||
52 | if ($source instanceof $class) { |
||
53 | return call_user_func_array([$engines[$engine], 'create'], $args); |
||
54 | } |
||
55 | } |
||
56 | |||
57 | foreach ($engines as $engine => $class) { |
||
58 | if (call_user_func_array([$engines[$engine], 'canCreate'], $args)) { |
||
59 | return call_user_func_array([$engines[$engine], 'create'], $args); |
||
60 | } |
||
61 | } |
||
62 | |||
63 | throw new \Exception('No available engine for ' . get_class($source)); |
||
64 | } |
||
65 | |||
66 | /** |
||
67 | * Get request object. |
||
68 | * |
||
69 | * @return \Yajra\DataTables\Utilities\Request |
||
70 | */ |
||
71 | public function getRequest() |
||
75 | |||
76 | /** |
||
77 | * Get config instance. |
||
78 | * |
||
79 | * @return \Yajra\DataTables\Utilities\Config |
||
80 | */ |
||
81 | public function getConfig() |
||
85 | |||
86 | /** |
||
87 | * @deprecated Please use query() instead, this method will be removed in a next version. |
||
88 | * @param $builder |
||
89 | * @return QueryDataTable |
||
90 | */ |
||
91 | public function queryBuilder($builder) |
||
95 | |||
96 | /** |
||
97 | * DataTables using Query. |
||
98 | * |
||
99 | * @param \Illuminate\Database\Query\Builder|mixed $builder |
||
100 | * @return DataTableAbstract|QueryDataTable |
||
101 | */ |
||
102 | public function query($builder) |
||
103 | { |
||
104 | return QueryDataTable::create($builder); |
||
105 | } |
||
106 | |||
107 | /** |
||
108 | * DataTables using Eloquent Builder. |
||
109 | * |
||
110 | * @param \Illuminate\Database\Eloquent\Builder|mixed $builder |
||
111 | * @return DataTableAbstract|EloquentDataTable |
||
112 | */ |
||
113 | public function eloquent($builder) |
||
117 | |||
118 | /** |
||
119 | * DataTables using Collection. |
||
120 | * |
||
121 | * @param \Illuminate\Support\Collection|array $collection |
||
122 | * @return DataTableAbstract|CollectionDataTable |
||
123 | */ |
||
124 | public function collection($collection) |
||
128 | |||
129 | /** |
||
130 | * DataTables using Collection. |
||
131 | * |
||
132 | * @param \Illuminate\Http\Resources\Json\AnonymousResourceCollection|array $collection |
||
|
|||
133 | * @return DataTableAbstract|ApiResourceDataTable |
||
134 | */ |
||
135 | public function resource($resource) |
||
139 | |||
140 | /** |
||
141 | * Get html builder instance. |
||
142 | * |
||
143 | * @return \Yajra\DataTables\Html\Builder |
||
144 | * @throws \Exception |
||
145 | */ |
||
146 | public function getHtmlBuilder() |
||
154 | } |
||
155 |
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter
$italy
is not defined by the methodfinale(...)
.The most likely cause is that the parameter was removed, but the annotation was not.