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()); |
|
|
|
|
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()); |
|
|
|
|
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()); |
|
|
|
|
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()); |
|
|
|
|
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
|
|
|
|