Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
2 / 2 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
Price | |
100.00% |
2 / 2 |
|
100.00% |
2 / 2 |
2 | |
100.00% |
1 / 1 |
__construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
add | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 |
1 | <?php |
2 | |
3 | declare(strict_types=1); |
4 | |
5 | namespace Alfa\Interview\Context\ValueObject; |
6 | |
7 | class Price |
8 | { |
9 | public function __construct(public readonly int $ammount) |
10 | { |
11 | } |
12 | |
13 | public function add(self $toAdd): self |
14 | { |
15 | return new self($this->ammount + $toAdd->ammount); |
16 | } |
17 | } |