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