1 | <?php namespace C4tech\RayEmitter\Domain; |
||
6 | abstract class ValueObjectCollection extends ValueObject |
||
7 | { |
||
8 | /** |
||
9 | * Collection Class |
||
10 | * |
||
11 | * Class name of member Value Objects |
||
12 | * @var string |
||
13 | */ |
||
14 | protected $collectionClass = ''; |
||
15 | |||
16 | public function __construct(array $values = []) |
||
21 | |||
22 | /** |
||
23 | * @inheritDoc |
||
24 | */ |
||
25 | public function equals(ValueObjectInterface $other) |
||
37 | |||
38 | /** |
||
39 | * Get Hash |
||
40 | * |
||
41 | * Calculate an md5 sum of the collection. |
||
42 | * @return string |
||
43 | */ |
||
44 | public function getHash() |
||
48 | |||
49 | /** |
||
50 | * @inheritDoc |
||
51 | */ |
||
52 | public function getValue() |
||
56 | |||
57 | /** |
||
58 | * @inheritDoc |
||
59 | */ |
||
60 | public function jsonSerialize() |
||
67 | |||
68 | /** |
||
69 | * @inheritDoc |
||
70 | */ |
||
71 | public static function jsonUnserialize($json) |
||
85 | |||
86 | public function push(ValueObject $value) |
||
90 | |||
91 | /** |
||
92 | * Sort By Value |
||
93 | * |
||
94 | * Sort the array by the VO's value. |
||
95 | * @return void |
||
96 | */ |
||
97 | private function sort() |
||
103 | } |
||
104 |
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: