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 | 12 | public function __construct(Integer $value, Integer $scale) |
|
31 | ); |
||
32 | 12 | } |
|
33 | |||
34 | 8 | public static function of(Integer $value, Integer $scale): self |
|
35 | { |
||
36 | 8 | SignedLongInteger::of($value); |
|
37 | 4 | UnsignedOctet::of($scale); |
|
38 | |||
39 | return new self($value, $scale); |
||
40 | } |
||
41 | |||
42 | 6 | public static function fromStream(Readable $stream): Value |
|
43 | { |
||
44 | 6 | $scale = UnsignedOctet::fromStream($stream)->original(); |
|
45 | 6 | $value = SignedLongInteger::fromStream($stream)->original(); |
|
46 | |||
47 | 6 | return new self($value, $scale); |
|
48 | } |
||
49 | |||
50 | 10 | public function original(): Number |
|
51 | { |
||
52 | 10 | return $this->original; |
|
53 | } |
||
54 | |||
55 | 10 | public function __toString(): string |
|
58 | } |
||
59 | |||
60 | public static function definitionSet(): Set |
||
63 | } |
||
64 | } |
||
65 |