1 | <?php |
||
22 | abstract class Model implements Arrayable, Jsonable, Stringable, JsonSerializable |
||
23 | { |
||
24 | use Presentable, Eventable, Mergeable; |
||
25 | use Idable, Userable, Timestampable; |
||
26 | use Fillable, Cacheable; |
||
27 | |||
28 | /** |
||
29 | * @var IDAL |
||
30 | */ |
||
31 | public $_dal; |
||
32 | |||
33 | /** |
||
34 | * @var bool |
||
35 | */ |
||
36 | public $_exist = false; |
||
37 | |||
38 | /** |
||
39 | * Create a new instance. |
||
40 | * |
||
41 | * @param IDAL $dal |
||
42 | * @param array $attributes |
||
43 | */ |
||
44 | 52 | public function __construct(IDAL $dal, array $attributes = []) |
|
50 | |||
51 | /** |
||
52 | * {@inheritdoc} |
||
53 | */ |
||
54 | public function toArray() |
||
60 | |||
61 | /** |
||
62 | * {@inheritdoc} |
||
63 | */ |
||
64 | public function jsonSerialize() |
||
68 | |||
69 | /** |
||
70 | * Save the model. |
||
71 | * |
||
72 | * @param array $columns |
||
73 | * @return bool |
||
74 | */ |
||
75 | 24 | public function save($columns = ['*']) |
|
97 | |||
98 | /** |
||
99 | * Delete the model. |
||
100 | * |
||
101 | * @return bool |
||
102 | */ |
||
103 | 6 | public function delete() |
|
122 | |||
123 | /** |
||
124 | * @return static |
||
125 | */ |
||
126 | 38 | final public static function createInstance() |
|
130 | |||
131 | /** |
||
132 | * Find a model by its primary key. |
||
133 | * |
||
134 | * @param mixed $id |
||
135 | * @param array $columns |
||
136 | * @param array $options |
||
137 | * @return static |
||
138 | */ |
||
139 | 22 | public static function find($id, array $columns = ['*'], $options = []) |
|
172 | |||
173 | /** |
||
174 | * Find a model by its primary key or return new model. |
||
175 | * |
||
176 | * @param mixed $id |
||
177 | * @return static |
||
178 | */ |
||
179 | 2 | public static function findOrNew($id) |
|
188 | |||
189 | /** |
||
190 | * Find a model by its primary key or throw an exception. |
||
191 | * |
||
192 | * @param mixed $id |
||
193 | * @param array $columns |
||
194 | * @param int $parent |
||
195 | * @return static |
||
196 | */ |
||
197 | 4 | public static function findOrFail($id, array $columns = ['*'], $parent = null) |
|
205 | |||
206 | /** |
||
207 | * Save a new model and return the instance. |
||
208 | * |
||
209 | * @param array $attributes |
||
210 | * @throws Exception |
||
211 | * @return static |
||
212 | */ |
||
213 | 8 | public static function create(array $attributes = []) |
|
227 | |||
228 | /** |
||
229 | * Destroy the models by the given id. |
||
230 | * |
||
231 | * @param mixed $id |
||
232 | */ |
||
233 | 2 | public static function destroy($id) |
|
243 | } |
||
244 |
This check looks for function calls that miss required arguments.