Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
5 / 5
100.00% covered (success)
100.00%
1 / 1
CRAP
100.00% covered (success)
100.00%
1 / 1
DiscountType
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
1 / 1
3
100.00% covered (success)
100.00%
1 / 1
 label
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
1 / 1
3
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\Discount\Domain\ValueObject;
8
9defined('AMMONLY_APP') || exit('Direct script access is forbidden.');
10
11/**
12 * Enumeration representing discount calculation types (percentage vs fixed amount).
13 */
14enum DiscountType: string
15{
16    case PERCENT = 'percent';
17    case AMOUNT = 'amount';
18
19    /**
20     * Get human-readable label for discount type.
21     */
22    public function label(): string
23    {
24        return match ($this) {
25            self::PERCENT => 'Percentage (%)',
26            self::AMOUNT => 'Fixed Amount',
27        };
28    }
29}