| Total Complexity | 8 |
| Total Lines | 65 |
| Duplicated Lines | 0 % |
| Coverage | 86.67% |
| Changes | 0 | ||
| 1 | <?php |
||
| 10 | class Balance |
||
| 11 | { |
||
| 12 | const TYPE_OPENING = 'opening'; |
||
| 13 | |||
| 14 | const TYPE_OPENING_AVAILABLE = 'opening_available'; |
||
| 15 | |||
| 16 | const TYPE_CLOSING = 'closing'; |
||
| 17 | |||
| 18 | const TYPE_CLOSING_AVAILABLE = 'closing_available'; |
||
| 19 | |||
| 20 | /** |
||
| 21 | * @var Money |
||
| 22 | */ |
||
| 23 | private $amount; |
||
| 24 | |||
| 25 | /** |
||
| 26 | * @var string |
||
| 27 | */ |
||
| 28 | private $type; |
||
| 29 | |||
| 30 | /** |
||
| 31 | 12 | * @var DateTimeImmutable |
|
| 32 | */ |
||
| 33 | 12 | private $date; |
|
| 34 | 12 | ||
| 35 | 12 | private function __construct(string $type, Money $amount, DateTimeImmutable $date) |
|
| 36 | 12 | { |
|
| 37 | $this->type = $type; |
||
| 38 | $this->amount = $amount; |
||
| 39 | $this->date = $date; |
||
| 40 | } |
||
| 41 | |||
| 42 | public function getDate(): DateTimeImmutable |
||
| 43 | 1 | { |
|
| 44 | return $this->date; |
||
| 45 | 1 | } |
|
| 46 | |||
| 47 | public function getAmount(): Money |
||
| 48 | 1 | { |
|
| 49 | return $this->amount; |
||
| 50 | 1 | } |
|
| 51 | |||
| 52 | public function getType(): string |
||
| 55 | 12 | } |
|
| 56 | |||
| 57 | public static function opening(Money $amount, DateTimeImmutable $date): self |
||
| 60 | 11 | } |
|
| 61 | |||
| 62 | public static function openingAvailable(Money $amount, DateTimeImmutable $date): self |
||
| 63 | { |
||
| 64 | return new self(self::TYPE_OPENING_AVAILABLE, $amount, $date); |
||
| 65 | } |
||
| 66 | |||
| 67 | public static function closing(Money $amount, DateTimeImmutable $date): self |
||
| 68 | { |
||
| 69 | return new self(self::TYPE_CLOSING, $amount, $date); |
||
| 70 | } |
||
| 71 | |||
| 72 | public static function closingAvailable(Money $amount, DateTimeImmutable $date): self |
||
| 75 | } |
||
| 76 | } |
||
| 77 |