1 | <?php |
||
7 | class Model |
||
8 | { |
||
9 | /** |
||
10 | * Allow data to be filled via the constructor. |
||
11 | * |
||
12 | * @param iterable $data |
||
13 | */ |
||
14 | 5 | public function __construct($data = null) |
|
15 | { |
||
16 | 5 | if (isset($data)) { |
|
17 | 5 | $this->fill($data); |
|
18 | } |
||
19 | 5 | } |
|
20 | |||
21 | /** |
||
22 | * Get an associative array of the attributes. |
||
23 | * |
||
24 | * @return array |
||
25 | */ |
||
26 | 5 | public function getAttributes() |
|
30 | |||
31 | /** |
||
32 | * Get the names of the attributes on this model. |
||
33 | * |
||
34 | * @return array |
||
35 | */ |
||
36 | public function getAttributeNames() |
||
40 | |||
41 | /** |
||
42 | * Populate the model with the supplied data. |
||
43 | * |
||
44 | * @param iterable $data |
||
45 | * @return $this |
||
46 | * @throws InvalidPropertyException |
||
47 | */ |
||
48 | 5 | public function fill($data) |
|
60 | } |
||
61 |