Code Duplication    Length = 21-22 lines in 3 locations

src/Taxes/IEPS.php 1 location

@@ 7-27 (lines=21) @@
4
5
use FeiMx\Tax\Contracts\TaxContract;
6
7
class IEPS extends Tax implements TaxContract
8
{
9
    /**
10
     * Code from the SAT Catalog.
11
     *
12
     * @var string
13
     */
14
    protected $code = '003';
15
16
    /**
17
     * Calculate tax percentage of a given amount.
18
     *
19
     * @param int $amount Amount for aclculate
20
     *
21
     * @return float Percetage
22
     */
23
    public function calculate($amount)
24
    {
25
        return number_format($amount * $this->percentage(), 6, '.', '');
26
    }
27
}
28

src/Taxes/ISR.php 1 location

@@ 7-28 (lines=22) @@
4
5
use FeiMx\Tax\Contracts\TaxContract;
6
7
class ISR extends Tax implements TaxContract
8
{
9
    /**
10
     * Code from the SAT Catalog.
11
     *
12
     * @var string
13
     */
14
    protected $code = '001';
15
16
    /**
17
     * Calculate tax percentage of a given amount.
18
     *
19
     * @param int $amount Amount for aclculate
20
     *
21
     * @return float Percetage
22
     */
23
    public function calculate($amount)
24
    {
25
        // return -(($amount * 0.16) / 3) * 2;
26
        return number_format($amount * $this->percentage(), 6, '.', '');
27
    }
28
}
29

src/Taxes/IVA.php 1 location

@@ 7-27 (lines=21) @@
4
5
use FeiMx\Tax\Contracts\TaxContract;
6
7
class IVA extends Tax implements TaxContract
8
{
9
    /**
10
     * Code from the SAT Catalog.
11
     *
12
     * @var string
13
     */
14
    protected $code = '002';
15
16
    /**
17
     * Calculate tax percentage of a given amount.
18
     *
19
     * @param int $amount Amount for calculated
20
     *
21
     * @return float Percetage
22
     */
23
    public function calculate($amount)
24
    {
25
        return number_format($amount * $this->percentage(), 6, '.', '');
26
    }
27
}
28