Total Complexity | 5 |
Total Lines | 45 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
23 | final class IndexValue |
||
24 | { |
||
25 | /** |
||
26 | * @var mixed |
||
27 | */ |
||
28 | public $value; |
||
29 | |||
30 | /** |
||
31 | * @param mixed $value |
||
32 | * |
||
33 | * @throws \ServiceBus\EventSourcing\Indexes\Exceptions\InvalidValueType |
||
34 | * @throws \ServiceBus\EventSourcing\Indexes\Exceptions\EmptyValuesNotAllowed |
||
35 | */ |
||
36 | 7 | public function __construct($value) |
|
37 | { |
||
38 | 7 | self::assertIsScalar($value); |
|
39 | 6 | self::assertNotEmpty($value); |
|
40 | |||
41 | 5 | $this->value = $value; |
|
42 | 5 | } |
|
43 | |||
44 | /** |
||
45 | * @param mixed $value |
||
46 | * |
||
47 | * @throws \ServiceBus\EventSourcing\Indexes\Exceptions\EmptyValuesNotAllowed |
||
48 | */ |
||
49 | 6 | private static function assertNotEmpty($value): void |
|
54 | } |
||
55 | 5 | } |
|
56 | |||
57 | /** |
||
58 | * @param mixed $value |
||
59 | * |
||
60 | * @throws \ServiceBus\EventSourcing\Indexes\Exceptions\InvalidValueType |
||
61 | */ |
||
62 | 7 | private static function assertIsScalar($value): void |
|
68 | ); |
||
69 | } |
||
72 |