Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
7 / 7
100.00% covered (success)
100.00%
1 / 1
CRAP
100.00% covered (success)
100.00%
1 / 1
TaxCalculationMode
100.00% covered (success)
100.00%
6 / 6
100.00% covered (success)
100.00%
1 / 1
5
100.00% covered (success)
100.00%
1 / 1
 label
100.00% covered (success)
100.00%
6 / 6
100.00% covered (success)
100.00%
1 / 1
5
1<?php
2
3declare(strict_types=1);
4
5/** @license For full copyright and license information, please see the LICENSE.md file. */
6
7namespace App\Modules\Tax\Domain\ValueObject;
8
9defined('AMMONLY_APP') || exit('Direct script access is forbidden.');
10
11/**
12 * Enumeration representing the calculation mode of a tax rate.
13 */
14enum TaxCalculationMode: string
15{
16    case EXCLUSIVE = 'exclusive';
17    case INCLUSIVE = 'inclusive';
18    case MARGIN = 'margin';
19    case WHT = 'wht';
20
21    /**
22     * Get human-readable label for calculation mode.
23     */
24    public function label(): string
25    {
26        return match ($this) {
27            self::EXCLUSIVE => 'Exclusive (Net + Tax)',
28            self::INCLUSIVE => 'Inclusive (Gross included)',
29            self::MARGIN => 'Margin Scheme (Tax on margin)',
30            self::WHT => 'Withholding Tax (Deduction)',
31        };
32    }
33}