1 | <?php |
||
13 | abstract class DataTransferObject |
||
14 | { |
||
15 | /** |
||
16 | * Array of casts to be performed. Keys are attribute names, values are type casts. |
||
17 | * |
||
18 | * @var array |
||
19 | */ |
||
20 | public $casts = []; |
||
21 | |||
22 | /** |
||
23 | * DataTransferObject constructor. |
||
24 | * |
||
25 | * @param array $attributes |
||
26 | * |
||
27 | * @throws \ReflectionException |
||
28 | * @throws \CodeBooth\DataTransferObject\Exceptions\DataException |
||
29 | */ |
||
30 | public function __construct(array $attributes) |
||
56 | |||
57 | /** |
||
58 | * Returns list of all properties and their value. |
||
59 | * |
||
60 | * @return array |
||
61 | * @throws \ReflectionException |
||
62 | */ |
||
63 | public function all() |
||
81 | |||
82 | /** |
||
83 | * @param \ReflectionClass $class |
||
84 | * |
||
85 | * @return array|\CodeBooth\DataTransferObject\Property[] |
||
86 | * @throws \ReflectionException |
||
87 | */ |
||
88 | protected function getProperties(ReflectionClass $class) |
||
98 | |||
99 | /** |
||
100 | * Check if the property name is reserved. |
||
101 | * |
||
102 | * @param string $propertyName |
||
103 | * |
||
104 | * @return bool |
||
105 | */ |
||
106 | protected function isReservedPropertyName(string $propertyName) |
||
110 | } |
||
111 |