AbstractEntryIdentifiable   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 13
c 0
b 0
f 0
dl 0
loc 31
ccs 12
cts 12
cp 1
rs 10
wmc 5

3 Methods

Rating   Name   Duplication   Size   Complexity  
A texto() 0 3 1
A __construct() 0 11 3
A id() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace PhpCfdi\SatCatalogos\Common;
6
7
use PhpCfdi\SatCatalogos\Exceptions\SatCatalogosLogicException;
8
9
abstract class AbstractEntryIdentifiable implements EntryIdentifiable
10
{
11
    use EntryWithVigenciasTrait;
12
13
    /** @var string */
14
    private $id;
15
16
    /** @var string */
17
    private $texto;
18
19 232
    public function __construct(string $id, string $texto, int $vigenteDesde, int $vigenteHasta)
20
    {
21 232
        if ('' === $id) {
22 1
            throw new SatCatalogosLogicException('El campo ID no puede ser una cadena de caracteres vacía');
23
        }
24 231
        if ('' === $texto) {
25 1
            throw new SatCatalogosLogicException('El campo texto no puede ser una cadena de caracteres vacía');
26
        }
27 230
        $this->id = $id;
28 230
        $this->texto = $texto;
29 230
        $this->setUpVigencias($vigenteDesde, $vigenteHasta);
30
    }
31
32 123
    public function id(): string
33
    {
34 123
        return $this->id;
35
    }
36
37 83
    public function texto(): string
38
    {
39 83
        return $this->texto;
40
    }
41
}
42