| Total Complexity | 7 |
| Total Lines | 43 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 18 | final class UnsignedLongLongInteger implements Value |
||
| 19 | { |
||
| 20 | private static $definitionSet; |
||
| 21 | |||
| 22 | private $value; |
||
| 23 | private $original; |
||
| 24 | |||
| 25 | 45 | public function __construct(Integer $value) |
|
| 26 | { |
||
| 27 | 45 | $this->original = $value; |
|
| 28 | 45 | } |
|
| 29 | |||
| 30 | 29 | public static function of(Integer $value): self |
|
| 31 | { |
||
| 32 | 29 | if (!self::definitionSet()->contains($value)) { |
|
| 33 | 1 | throw new OutOfRangeValue($value, self::definitionSet()); |
|
| 34 | } |
||
| 35 | |||
| 36 | 28 | return new self($value); |
|
| 37 | } |
||
| 38 | |||
| 39 | 28 | public static function fromStream(Readable $stream): Value |
|
| 40 | { |
||
| 41 | 28 | [, $value] = \unpack('J', (string) $stream->read(8)); |
|
| 42 | |||
| 43 | 28 | return new self(new Integer($value)); |
|
| 44 | } |
||
| 45 | |||
| 46 | 34 | public function original(): Integer |
|
| 47 | { |
||
| 48 | 34 | return $this->original; |
|
| 49 | } |
||
| 50 | |||
| 51 | 44 | public function __toString(): string |
|
| 54 | } |
||
| 55 | |||
| 56 | 29 | public static function definitionSet(): Set |
|
| 57 | { |
||
| 58 | 29 | return self::$definitionSet ?? self::$definitionSet = Range::inclusive( |
|
| 64 |