1 | <?php |
||
13 | trait SingleValueObjectTrait |
||
14 | { |
||
15 | private $value; |
||
16 | |||
17 | 21 | public function __construct($value) |
|
22 | |||
23 | /** |
||
24 | * @return mixed |
||
25 | */ |
||
26 | 9 | public function getValue() |
|
30 | |||
31 | /** |
||
32 | * Compare two SingleValueObject and tells whether they can be considered equal |
||
33 | * |
||
34 | * @param SingleValueObjectInterface $object |
||
35 | * @return bool |
||
36 | */ |
||
37 | 9 | public function sameValueAs(SingleValueObjectInterface $object) |
|
43 | |||
44 | /** |
||
45 | * @param string $string |
||
46 | * @throws InvalidArgumentException |
||
47 | */ |
||
48 | 3 | protected function throwInvalidArgumentMustBe($string) |
|
52 | |||
53 | /** |
||
54 | * @param mixed $value |
||
55 | * @return null |
||
56 | */ |
||
57 | abstract protected function validation($value); |
||
58 | } |
||
59 |