1 | <?php declare(strict_types=1); |
||
9 | class Hydrator |
||
10 | { |
||
11 | /** |
||
12 | * @var string |
||
13 | */ |
||
14 | protected $className; |
||
15 | |||
16 | /** |
||
17 | * @var array |
||
18 | */ |
||
19 | protected $mapping; |
||
20 | |||
21 | /** |
||
22 | * @var bool |
||
23 | */ |
||
24 | protected $ignoreSetters; |
||
25 | |||
26 | /** |
||
27 | * @var bool |
||
28 | */ |
||
29 | protected $ignoreGetters; |
||
30 | |||
31 | /** |
||
32 | * @var array |
||
33 | */ |
||
34 | protected $reflectionProperties = []; |
||
35 | |||
36 | /** |
||
37 | * @var array |
||
38 | */ |
||
39 | protected $propertySetters = []; |
||
40 | |||
41 | /** |
||
42 | * @var array |
||
43 | */ |
||
44 | protected $propertyGetters = []; |
||
45 | |||
46 | /** |
||
47 | * (non-phpdoc) |
||
48 | * |
||
49 | * @param string $className |
||
50 | * @param array $mapping |
||
51 | * @throws ReflectionException |
||
52 | */ |
||
53 | public function __construct( |
||
67 | |||
68 | /** |
||
69 | * (non-phpdoc) |
||
70 | * |
||
71 | * @param object $object |
||
72 | * @param array $data |
||
73 | * @return object |
||
74 | * @throws InvalidArgumentException |
||
75 | */ |
||
76 | public function hydrate($object, array $data) |
||
94 | |||
95 | /** |
||
96 | * (non-phpdoc) |
||
97 | * |
||
98 | * @param object $object |
||
99 | * @return array |
||
100 | */ |
||
101 | public function extract($object): array |
||
117 | |||
118 | /** |
||
119 | * (non-phpdoc) |
||
120 | * |
||
121 | * @param object $object |
||
122 | * @return void |
||
123 | * @throws InvalidArgumentException |
||
124 | */ |
||
125 | protected function validateObject($object) |
||
131 | |||
132 | /** |
||
133 | * (non-phpdoc) |
||
134 | * |
||
135 | * @param array $mapping |
||
136 | * @return void |
||
137 | */ |
||
138 | protected function fixMapping(array $mapping) |
||
148 | |||
149 | /** |
||
150 | * (non-phpdoc) |
||
151 | * |
||
152 | * @param ReflectionClass $reflectionClass |
||
153 | * @return void |
||
154 | */ |
||
155 | protected function initialize(ReflectionClass $reflectionClass) |
||
184 | |||
185 | /** |
||
186 | * (non-phpdoc) |
||
187 | * |
||
188 | * @param ReflectionClass $reflectionClass |
||
189 | * @param string $methodName |
||
190 | * @return void |
||
191 | */ |
||
192 | protected function isMethodExistsAndCallable(ReflectionClass $reflectionClass, string $methodName): bool |
||
206 | |||
207 | } |
||
208 |