| Total Complexity | 5 |
| Total Lines | 31 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 13 | final class Receipt |
||
| 14 | { |
||
| 15 | private $identity; |
||
| 16 | private $product; |
||
| 17 | private $date; |
||
| 18 | |||
| 19 | public function __construct(Identity $identity, Product $product, DateTimeInterface $date = null) |
||
| 20 | { |
||
| 21 | $this->identity = $identity; |
||
| 22 | $this->product = $product; |
||
| 23 | $this->date = $date ?? new DateTimeImmutable(); |
||
| 24 | } |
||
| 25 | |||
| 26 | public function identity(): Identity |
||
| 27 | { |
||
| 28 | return $this->identity; |
||
| 29 | } |
||
| 30 | |||
| 31 | public function product(): Product |
||
| 32 | { |
||
| 33 | return $this->product; |
||
| 34 | } |
||
| 35 | |||
| 36 | public function price(): Credit |
||
| 37 | { |
||
| 38 | return $this->product->price(); |
||
| 39 | } |
||
| 40 | |||
| 41 | public function date(): DateTimeInterface |
||
| 44 | } |
||
| 45 | } |
||
| 46 |