| 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 | 12 | public function __construct($value) |
|
| 37 | { |
||
| 38 | 12 | self::assertIsScalar($value); |
|
| 39 | 11 | self::assertNotEmpty($value); |
|
| 40 | |||
| 41 | 10 | $this->value = $value; |
|
| 42 | 10 | } |
|
| 43 | |||
| 44 | /** |
||
| 45 | * @param mixed $value |
||
| 46 | * |
||
| 47 | * @throws \ServiceBus\EventSourcing\Indexes\Exceptions\EmptyValuesNotAllowed |
||
| 48 | */ |
||
| 49 | 11 | private static function assertNotEmpty($value): void |
|
| 54 | } |
||
| 55 | 10 | } |
|
| 56 | |||
| 57 | /** |
||
| 58 | * @param mixed $value |
||
| 59 | * |
||
| 60 | * @throws \ServiceBus\EventSourcing\Indexes\Exceptions\InvalidValueType |
||
| 61 | */ |
||
| 62 | 12 | private static function assertIsScalar($value): void |
|
| 68 | ); |
||
| 69 | } |
||
| 72 |