Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
5 / 5 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
| RoundingStrategy | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
3 | |
100.00% |
1 / 1 |
| label | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
3 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | /** @license For full copyright and license information, please see the LICENSE.md file. */ |
| 6 | |
| 7 | namespace App\Modules\Tax\Domain\ValueObject; |
| 8 | |
| 9 | defined('AMMONLY_APP') || exit('Direct script access is forbidden.'); |
| 10 | |
| 11 | /** |
| 12 | * Enumeration representing tax calculation and rounding level. |
| 13 | */ |
| 14 | enum RoundingStrategy: string |
| 15 | { |
| 16 | case LINE_LEVEL = 'line_level'; |
| 17 | case HEADER_LEVEL = 'header_level'; |
| 18 | |
| 19 | /** |
| 20 | * Get human-readable description for rounding strategy. |
| 21 | */ |
| 22 | public function label(): string |
| 23 | { |
| 24 | return match ($this) { |
| 25 | self::LINE_LEVEL => 'Line Level (Round each row)', |
| 26 | self::HEADER_LEVEL => 'Header Level (Sum bases, then round per rate)', |
| 27 | }; |
| 28 | } |
| 29 | } |