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

Mercancias::getAutotransporte()   A

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 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
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
namespace CfdiUtils\Elements\CartaPorte20;
4
5
use CfdiUtils\Elements\Common\AbstractElement;
6
7
class Mercancias extends AbstractElement
8
{
9 2
    public function getElementName(): string
10
    {
11 2
        return 'cartaporte20:Mercancias';
12
    }
13
14 2
    public function getChildrenOrder(): array
15
    {
16
        return [
17 2
        'cartaporte20:Mercancia',
18
        'cartaporte20:Autotransporte',
19
        'cartaporte20:TransporteMaritimo',
20
        'cartaporte20:TransporteAereo',
21
        'cartaporte20:TransporteFerroviario', ];
22
    }
23
24 1
    public function addMercancia(array $attributes = []): Mercancia
25
    {
26 1
        $subject = new Mercancia($attributes);
27 1
        $this->addChild($subject);
28 1
        return $subject;
29
    }
30
31 1
    public function multiMercancia(array ...$elementAttributes): self
32
    {
33 1
        foreach ($elementAttributes as $attributes) {
34 1
            $this->addMercancia($attributes);
35
        }
36 1
        return $this;
37
    }
38
39 1
    public function getAutotransporte(): Autotransporte
40
    {
41 1
        return $this->helperGetOrAdd(new Autotransporte());
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->helperGetO...rte20\Autotransporte()) could return the type CfdiUtils\Elements\CartaPorte20\Mercancias which is incompatible with the type-hinted return CfdiUtils\Elements\CartaPorte20\Autotransporte. Consider adding an additional type-check to rule them out.
Loading history...
42
    }
43
44 1
    public function addAutotransporte(array $attributes = []): Autotransporte
45
    {
46 1
        $subject = $this->getAutotransporte();
47 1
        $subject->addAttributes($attributes);
48 1
        return $subject;
49
    }
50
51 1
    public function getTransporteMaritimo(): TransporteMaritimo
52
    {
53 1
        return $this->helperGetOrAdd(new TransporteMaritimo());
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->helperGetO...0\TransporteMaritimo()) could return the type CfdiUtils\Elements\CartaPorte20\Mercancias which is incompatible with the type-hinted return CfdiUtils\Elements\CartaPorte20\TransporteMaritimo. Consider adding an additional type-check to rule them out.
Loading history...
54
    }
55
56 1
    public function addTransporteMaritimo(array $attributes = []): TransporteMaritimo
57
    {
58 1
        $subject = $this->getTransporteMaritimo();
59 1
        $subject->addAttributes($attributes);
60 1
        return $subject;
61
    }
62
63 1
    public function getTransporteAereo(): TransporteAereo
64
    {
65 1
        return $this->helperGetOrAdd(new TransporteAereo());
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->helperGetO...te20\TransporteAereo()) could return the type CfdiUtils\Elements\CartaPorte20\Mercancias which is incompatible with the type-hinted return CfdiUtils\Elements\CartaPorte20\TransporteAereo. Consider adding an additional type-check to rule them out.
Loading history...
66
    }
67
68 1
    public function addTransporteAereo(array $attributes = []): TransporteAereo
69
    {
70 1
        $subject = $this->getTransporteAereo();
71 1
        $subject->addAttributes($attributes);
72 1
        return $subject;
73
    }
74
75 1
    public function getTransporteFerroviario(): TransporteFerroviario
76
    {
77 1
        return $this->helperGetOrAdd(new TransporteFerroviario());
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->helperGetO...ransporteFerroviario()) could return the type CfdiUtils\Elements\CartaPorte20\Mercancias which is incompatible with the type-hinted return CfdiUtils\Elements\Carta...0\TransporteFerroviario. Consider adding an additional type-check to rule them out.
Loading history...
78
    }
79
80 1
    public function addTransporteFerroviario(array $attributes = []): TransporteFerroviario
81
    {
82 1
        $subject = $this->getTransporteFerroviario();
83 1
        $subject->addAttributes($attributes);
84 1
        return $subject;
85
    }
86
}
87