1 | <?php |
||
7 | class Mapper |
||
8 | { |
||
9 | /** |
||
10 | * @var array |
||
11 | */ |
||
12 | protected $columnsAsAttributesMap; |
||
13 | |||
14 | /** |
||
15 | * @param array $columnsAsAttributesMap |
||
16 | * @param array $serialized |
||
17 | */ |
||
18 | public function __construct(array $columnsAsAttributesMap, array $serialized = []) |
||
23 | |||
24 | /** |
||
25 | * @param EntityInterface $entity |
||
26 | * @return array |
||
27 | */ |
||
28 | public function toTableRow(EntityInterface $entity) |
||
42 | |||
43 | /** |
||
44 | * @param array $row |
||
45 | * @return array |
||
46 | */ |
||
47 | public function fromTableRow(array $row) |
||
55 | |||
56 | /** |
||
57 | * @param array $rows |
||
58 | * @return array |
||
59 | */ |
||
60 | public function fromTableRows(array $rows) |
||
69 | |||
70 | /** |
||
71 | * @param array $array1 |
||
72 | * @param array $array2 |
||
73 | * @return array |
||
74 | */ |
||
75 | private function getIntersectValuesAsKeys($array1, $array2) |
||
87 | |||
88 | /** |
||
89 | * @param array $row |
||
90 | * @param bool $serialize |
||
91 | * @return array |
||
92 | */ |
||
93 | private function serialize(array $row, $serialize = true) |
||
105 | } |
||
106 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: