| 1 | <?php |
||
| 12 | class SimpleItem implements Billable |
||
| 13 | { |
||
| 14 | /** |
||
| 15 | * @var string |
||
| 16 | */ |
||
| 17 | private $description; |
||
| 18 | |||
| 19 | /** |
||
| 20 | * @var Amount |
||
| 21 | */ |
||
| 22 | private $unitCost; |
||
| 23 | |||
| 24 | /** |
||
| 25 | * @var int |
||
| 26 | */ |
||
| 27 | private $units; |
||
| 28 | |||
| 29 | /** |
||
| 30 | * @var Amount |
||
| 31 | */ |
||
| 32 | private $vat; |
||
| 33 | |||
| 34 | /** |
||
| 35 | * Set immutable data at construct |
||
| 36 | * |
||
| 37 | * Note that a VAT of 25% is represented as .25 |
||
| 38 | */ |
||
| 39 | 5 | public function __construct(string $description, Amount $unitCost, int $units = 1, Amount $vat = null) |
|
| 46 | |||
| 47 | 2 | public function getBillingDescription(): string |
|
| 51 | |||
| 52 | 2 | public function getCostPerUnit(): Amount |
|
| 56 | |||
| 57 | 2 | public function getNrOfUnits(): int |
|
| 61 | |||
| 62 | 2 | public function getVatRate(): Amount |
|
| 66 | } |
||
| 67 |