1 | <?php |
||
8 | class BinderObject implements DumpToArrayInterface |
||
9 | { |
||
10 | |||
11 | /** |
||
12 | * Bind the properties from an object to the properties matching to the current instance |
||
13 | * |
||
14 | * @param mixed $source |
||
15 | */ |
||
16 | public function bind($source) |
||
20 | |||
21 | /** |
||
22 | * Bind the properties from the current instance to the properties matching to an object |
||
23 | * |
||
24 | * @param mixed $target |
||
25 | */ |
||
26 | public function bindTo($target) |
||
30 | |||
31 | /** |
||
32 | * Get all properties from the current instance as an associative array |
||
33 | * |
||
34 | * @return array The object properties as array |
||
35 | */ |
||
36 | public function toArray() |
||
40 | |||
41 | /** |
||
42 | * Bind the properties from a source object to the properties matching to a target object |
||
43 | * |
||
44 | * @param mixed $source |
||
45 | * @param mixed $target |
||
46 | */ |
||
47 | public static function bindObject($source, $target) |
||
55 | |||
56 | /** |
||
57 | * Get all properties from a source object as an associative array |
||
58 | * |
||
59 | * @param mixed $source |
||
60 | * @return array |
||
61 | */ |
||
62 | public static function toArrayFrom($source) |
||
69 | |||
70 | protected static $propNameLower = []; |
||
71 | |||
72 | /** |
||
73 | * Set the property value |
||
74 | * |
||
75 | * @param mixed $obj |
||
76 | * @param string $propName |
||
77 | * @param string $value |
||
78 | */ |
||
79 | protected static function setPropValue($obj, $propName, $value) |
||
105 | } |
||
106 |