Passed
Push — master ( d63c85...cd60ee )
by Carlos C
04:35 queued 02:22
created

Mercancia::multiCantidadTransporta()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 3
c 1
b 0
f 0
nc 2
nop 1
dl 0
loc 6
ccs 4
cts 4
cp 1
crap 2
rs 10
1
<?php
2
3
namespace CfdiUtils\Elements\CartaPorte20;
4
5
use CfdiUtils\Elements\Common\AbstractElement;
6
7
class Mercancia extends AbstractElement
8
{
9 2
    public function getElementName(): string
10
    {
11 2
        return 'cartaporte20:Mercancia';
12
    }
13
14 2
    public function getChildrenOrder(): array
15
    {
16
        return [
17 2
        'cartaporte20:Pedimentos',
18
        'cartaporte20:GuiasIdentificacion',
19
        'cartaporte20:CantidadTransporta',
20
        'cartaporte20:DetalleMercancia', ];
21
    }
22
23 1
    public function addPedimentos(array $attributes = []): Pedimentos
24
    {
25 1
        $subject = new Pedimentos($attributes);
26 1
        $this->addChild($subject);
27 1
        return $subject;
28
    }
29
30 1
    public function multiPedimentos(array ...$elementAttributes): self
31
    {
32 1
        foreach ($elementAttributes as $attributes) {
33 1
            $this->addPedimentos($attributes);
34
        }
35 1
        return $this;
36
    }
37
38 1
    public function addGuiasIdentificacion(array $attributes = []): GuiasIdentificacion
39
    {
40 1
        $subject = new GuiasIdentificacion($attributes);
41 1
        $this->addChild($subject);
42 1
        return $subject;
43
    }
44
45 1
    public function multiGuiasIdentificacion(array ...$elementAttributes): self
46
    {
47 1
        foreach ($elementAttributes as $attributes) {
48 1
            $this->addGuiasIdentificacion($attributes);
49
        }
50 1
        return $this;
51
    }
52
53 1
    public function addCantidadTransporta(array $attributes = []): CantidadTransporta
54
    {
55 1
        $subject = new CantidadTransporta($attributes);
56 1
        $this->addChild($subject);
57 1
        return $subject;
58
    }
59
60 1
    public function multiCantidadTransporta(array ...$elementAttributes): self
61
    {
62 1
        foreach ($elementAttributes as $attributes) {
63 1
            $this->addCantidadTransporta($attributes);
64
        }
65 1
        return $this;
66
    }
67
68 1
    public function getDetalleMercancia(): DetalleMercancia
69
    {
70 1
        return $this->helperGetOrAdd(new DetalleMercancia());
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->helperGetO...e20\DetalleMercancia()) could return the type CfdiUtils\Elements\CartaPorte20\Mercancia which is incompatible with the type-hinted return CfdiUtils\Elements\CartaPorte20\DetalleMercancia. Consider adding an additional type-check to rule them out.
Loading history...
71
    }
72
73 1
    public function addDetalleMercancia(array $attributes = []): DetalleMercancia
74
    {
75 1
        $subject = $this->getDetalleMercancia();
76 1
        $subject->addAttributes($attributes);
77 1
        return $subject;
78
    }
79
}
80