| 1 | <?php |
||
| 7 | class Entity implements \Tarantool\Mapper\Contracts\Entity |
||
| 8 | { |
||
| 9 | private $id; |
||
|
|
|||
| 10 | |||
| 11 | 1 | public function __construct(array $data = null) |
|
| 12 | { |
||
| 13 | 1 | if ($data) { |
|
| 14 | 1 | $this->update($data); |
|
| 15 | 1 | } |
|
| 16 | 1 | } |
|
| 17 | |||
| 18 | 1 | public function update($data) |
|
| 19 | { |
||
| 20 | 1 | foreach ($data as $k => $v) { |
|
| 21 | 1 | $this->$k = $v; |
|
| 22 | 1 | } |
|
| 23 | 1 | } |
|
| 24 | |||
| 25 | 1 | public function __set($key, $value) |
|
| 33 | |||
| 34 | 1 | public function __get($key) |
|
| 35 | { |
||
| 36 | 1 | if (property_exists($this, $key)) { |
|
| 37 | 1 | return $this->$key; |
|
| 38 | } |
||
| 39 | } |
||
| 40 | |||
| 41 | /** |
||
| 42 | * @return int |
||
| 43 | */ |
||
| 44 | 1 | public function getId() |
|
| 48 | |||
| 49 | /** |
||
| 50 | * @return Entity |
||
| 51 | */ |
||
| 52 | 1 | public function setId($id) |
|
| 58 | |||
| 59 | /** |
||
| 60 | * @return array |
||
| 61 | */ |
||
| 62 | public function toArray($recursive = false) |
||
| 74 | |||
| 75 | public function __call($name, $params) |
||
| 88 | } |
||
| 89 |
This check marks private properties in classes that are never used. Those properties can be removed.