| Total Complexity | 5 |
| Total Lines | 61 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 15 | final class BillContext |
||
| 16 | { |
||
| 17 | private $amount; |
||
| 18 | private $structure; |
||
| 19 | |||
| 20 | /** |
||
| 21 | * Constructor |
||
| 22 | * |
||
| 23 | * @param float $amount The amount to be billed |
||
| 24 | * @param string $structure The billing structure to be applied on $amount |
||
| 25 | */ |
||
| 26 | 22 | public function __construct(float $amount, string $structure) |
|
| 27 | { |
||
| 28 | 22 | $this->amount = $amount; |
|
| 29 | 22 | $this->setStructure($structure); |
|
| 30 | 22 | } |
|
| 31 | |||
| 32 | /** |
||
| 33 | * Returns the amount |
||
| 34 | * |
||
| 35 | * @return float |
||
| 36 | */ |
||
| 37 | 6 | public function getAmount(): float |
|
| 38 | { |
||
| 39 | 6 | return $this->amount; |
|
| 40 | } |
||
| 41 | |||
| 42 | /** |
||
| 43 | * Sets the amount and returns this instance |
||
| 44 | * |
||
| 45 | * @param float $amount The amount to be billed |
||
| 46 | * |
||
| 47 | * @return BillContext |
||
| 48 | */ |
||
| 49 | 5 | public function setAmount(float $amount) |
|
| 53 | } |
||
| 54 | |||
| 55 | /** |
||
| 56 | * Returns the structure for this context |
||
| 57 | * |
||
| 58 | * @return string |
||
| 59 | */ |
||
| 60 | 22 | public function getStructure(): string |
|
| 63 | } |
||
| 64 | |||
| 65 | /** |
||
| 66 | * Sets the billing structure for the context |
||
| 67 | * |
||
| 68 | * @param string $structure The billing structure |
||
| 69 | * |
||
| 70 | * @return BillContext |
||
| 71 | */ |
||
| 72 | 22 | public function setStructure(string $structure) |
|
| 78 |