Moneda   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 12
c 1
b 0
f 0
dl 0
loc 35
ccs 12
cts 12
cp 1
rs 10
wmc 5

3 Methods

Rating   Name   Duplication   Size   Complexity  
A decimales() 0 3 1
A __construct() 0 17 3
A porcentajeVariacion() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace PhpCfdi\SatCatalogos\CFDI40;
6
7
use PhpCfdi\SatCatalogos\Common\AbstractEntryIdentifiable;
8
use PhpCfdi\SatCatalogos\Exceptions\SatCatalogosLogicException;
9
10
class Moneda extends AbstractEntryIdentifiable
11
{
12
    /** @var int */
13
    private $decimales;
14
15
    /** @var int */
16
    private $porcentajeVariacion;
17
18 4
    public function __construct(
19
        string $id,
20
        string $texto,
21
        int $decimales,
22
        int $porcentajeVariacion,
23
        int $vigenteDesde,
24
        int $vigenteHasta
25
    ) {
26 4
        parent::__construct($id, $texto, $vigenteDesde, $vigenteHasta);
27 4
        if ($decimales < 0) {
28 1
            throw new SatCatalogosLogicException('El campo decimales no puede ser menor a cero');
29
        }
30 3
        if ($porcentajeVariacion < 0) {
31 1
            throw new SatCatalogosLogicException('El campo porcentaje de variación no puede ser menor a cero');
32
        }
33 2
        $this->decimales = $decimales;
34 2
        $this->porcentajeVariacion = $porcentajeVariacion;
35
    }
36
37 1
    public function decimales(): int
38
    {
39 1
        return $this->decimales;
40
    }
41
42 1
    public function porcentajeVariacion(): int
43
    {
44 1
        return $this->porcentajeVariacion;
45
    }
46
}
47