| Total Complexity | 6 |
| Total Lines | 47 |
| Duplicated Lines | 0 % |
| Coverage | 85% |
| Changes | 0 | ||
| 1 | <?php |
||
| 16 | final class Decimal implements Value |
||
| 17 | { |
||
| 18 | private static $definitionSet; |
||
| 19 | |||
| 20 | private $string; |
||
| 21 | private $value; |
||
| 22 | private $scale; |
||
| 23 | private $original; |
||
| 24 | |||
| 25 | 6 | public function __construct(Integer $value, Integer $scale) |
|
| 31 | ); |
||
| 32 | 6 | } |
|
| 33 | |||
| 34 | 4 | public static function of(Integer $value, Integer $scale): self |
|
| 35 | { |
||
| 36 | 4 | SignedLongInteger::of($value); |
|
| 37 | 2 | UnsignedOctet::of($scale); |
|
| 38 | |||
| 39 | return new self($value, $scale); |
||
| 40 | } |
||
| 41 | |||
| 42 | 3 | public static function fromStream(Readable $stream): Value |
|
| 43 | { |
||
| 44 | 3 | $scale = UnsignedOctet::fromStream($stream)->original(); |
|
| 45 | 3 | $value = SignedLongInteger::fromStream($stream)->original(); |
|
| 46 | |||
| 47 | 3 | return new self($value, $scale); |
|
| 48 | } |
||
| 49 | |||
| 50 | 5 | public function original(): Number |
|
| 51 | { |
||
| 52 | 5 | return $this->original; |
|
| 53 | } |
||
| 54 | |||
| 55 | 5 | public function __toString(): string |
|
| 58 | } |
||
| 59 | |||
| 60 | public static function definitionSet(): Set |
||
| 63 | } |
||
| 64 | } |
||
| 65 |