1 | <?php |
||
4 | class BaseModel implements ModelInterface |
||
5 | { |
||
6 | |||
7 | /** |
||
8 | * Model Data |
||
9 | * |
||
10 | * @var array |
||
11 | */ |
||
12 | protected $data; |
||
13 | |||
14 | /** |
||
15 | * Create a new Model instance |
||
16 | * |
||
17 | * @param array $data |
||
18 | */ |
||
19 | 36 | public function __construct(array $data) |
|
23 | |||
24 | /** |
||
25 | * Get the Model data |
||
26 | * |
||
27 | * @return array |
||
28 | */ |
||
29 | 1 | public function getData() |
|
33 | |||
34 | /** |
||
35 | * Get Data Property |
||
36 | * |
||
37 | * @param string $property |
||
38 | * |
||
39 | * @return mixed |
||
40 | */ |
||
41 | 35 | public function getDataProperty($property) |
|
45 | |||
46 | /** |
||
47 | * Handle calls to undefined properties. |
||
48 | * Check whether an item with the key, |
||
49 | * same as the property, is available |
||
50 | * on the data property. |
||
51 | * |
||
52 | * @param string $property |
||
53 | * |
||
54 | * @return mixed|null |
||
55 | */ |
||
56 | public function __get($property) |
||
64 | |||
65 | /** |
||
66 | * Handle calls to undefined properties. |
||
67 | * Sets an item with the defined value |
||
68 | * on the data property. |
||
69 | * |
||
70 | * @param string $property |
||
71 | * @param string $value |
||
72 | * |
||
73 | * @return mixed|null |
||
74 | */ |
||
75 | public function __set($property, $value) |
||
79 | } |
||
80 |