AbstractEntryIdentifiable::id()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
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