| Total Complexity | 6 |
| Total Lines | 38 |
| Duplicated Lines | 0 % |
| Coverage | 93.75% |
| Changes | 0 | ||
| 1 | <?php |
||
| 17 | final class UnsignedLongInteger implements Value |
||
| 18 | { |
||
| 19 | private static $definitionSet; |
||
| 20 | |||
| 21 | private $value; |
||
| 22 | private $original; |
||
| 23 | |||
| 24 | 135 | public function __construct(Integer $value) |
|
| 25 | { |
||
| 26 | 135 | if (!self::definitionSet()->contains($value)) { |
|
| 27 | 2 | throw new OutOfRangeValue($value, self::definitionSet()); |
|
| 28 | } |
||
| 29 | |||
| 30 | 133 | $this->original = $value; |
|
| 31 | 133 | } |
|
| 32 | |||
| 33 | 76 | public static function fromStream(Readable $stream): Value |
|
| 34 | { |
||
| 35 | 76 | [, $value] = unpack('N', (string) $stream->read(4)); |
|
| 36 | |||
| 37 | 76 | return new self(new Integer($value)); |
|
| 38 | } |
||
| 39 | |||
| 40 | 68 | public function original(): Integer |
|
| 41 | { |
||
| 42 | 68 | return $this->original; |
|
| 43 | } |
||
| 44 | |||
| 45 | 132 | public function __toString(): string |
|
| 48 | } |
||
| 49 | |||
| 50 | 135 | public static function definitionSet(): Set |
|
| 55 | ); |
||
| 56 | } |
||
| 57 | } |
||
| 58 |