1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace CfdiUtils\Elements\Cce20; |
4
|
|
|
|
5
|
|
|
use CfdiUtils\Elements\Common\AbstractElement; |
6
|
|
|
|
7
|
|
|
class ComercioExterior extends AbstractElement |
8
|
|
|
{ |
9
|
1 |
|
public function getElementName(): string |
10
|
|
|
{ |
11
|
1 |
|
return 'cce20:ComercioExterior'; |
12
|
|
|
} |
13
|
|
|
|
14
|
1 |
|
public function getChildrenOrder(): array |
15
|
|
|
{ |
16
|
1 |
|
return [ |
17
|
1 |
|
'cce20:Emisor', |
18
|
1 |
|
'cce20:Propietario', |
19
|
1 |
|
'cce20:Receptor', |
20
|
1 |
|
'cce20:Destinatario', |
21
|
1 |
|
'cce20:Mercancias', |
22
|
1 |
|
]; |
23
|
|
|
} |
24
|
|
|
|
25
|
1 |
|
public function getFixedAttributes(): array |
26
|
|
|
{ |
27
|
1 |
|
return [ |
28
|
1 |
|
'xmlns:cce20' => 'http://www.sat.gob.mx/ComercioExterior20', |
29
|
1 |
|
'xsi:schemaLocation' => 'http://www.sat.gob.mx/ComercioExterior20' |
30
|
1 |
|
. ' http://www.sat.gob.mx/sitio_internet/cfd/ComercioExterior20/ComercioExterior20.xsd', |
31
|
1 |
|
'Version' => '2.0', |
32
|
1 |
|
]; |
33
|
|
|
} |
34
|
|
|
|
35
|
1 |
|
public function getEmisor(): Emisor |
36
|
|
|
{ |
37
|
1 |
|
return $this->helperGetOrAdd(new Emisor()); |
|
|
|
|
38
|
|
|
} |
39
|
|
|
|
40
|
1 |
|
public function addEmisor(array $attributes = []): Emisor |
41
|
|
|
{ |
42
|
1 |
|
$subject = $this->getEmisor(); |
43
|
1 |
|
$subject->addAttributes($attributes); |
44
|
1 |
|
return $subject; |
45
|
|
|
} |
46
|
|
|
|
47
|
1 |
|
public function addPropietario(array $attributes = []): Propietario |
48
|
|
|
{ |
49
|
1 |
|
$subject = new Propietario($attributes); |
50
|
1 |
|
$this->addChild($subject); |
51
|
1 |
|
return $subject; |
52
|
|
|
} |
53
|
|
|
|
54
|
1 |
|
public function multiPropietario(array ...$elementAttributes): self |
55
|
|
|
{ |
56
|
1 |
|
foreach ($elementAttributes as $attributes) { |
57
|
1 |
|
$this->addPropietario($attributes); |
58
|
|
|
} |
59
|
1 |
|
return $this; |
60
|
|
|
} |
61
|
|
|
|
62
|
1 |
|
public function getReceptor(): Receptor |
63
|
|
|
{ |
64
|
1 |
|
return $this->helperGetOrAdd(new Receptor()); |
|
|
|
|
65
|
|
|
} |
66
|
|
|
|
67
|
1 |
|
public function addReceptor(array $attributes = []): Receptor |
68
|
|
|
{ |
69
|
1 |
|
$subject = $this->getReceptor(); |
70
|
1 |
|
$subject->addAttributes($attributes); |
71
|
1 |
|
return $subject; |
72
|
|
|
} |
73
|
|
|
|
74
|
1 |
|
public function addDestinatario(array $attributes = []): Destinatario |
75
|
|
|
{ |
76
|
1 |
|
$subject = new Destinatario($attributes); |
77
|
1 |
|
$this->addChild($subject); |
78
|
1 |
|
return $subject; |
79
|
|
|
} |
80
|
|
|
|
81
|
1 |
|
public function multiDestinatario(array ...$elementAttributes): self |
82
|
|
|
{ |
83
|
1 |
|
foreach ($elementAttributes as $attributes) { |
84
|
1 |
|
$this->addDestinatario($attributes); |
85
|
|
|
} |
86
|
1 |
|
return $this; |
87
|
|
|
} |
88
|
|
|
|
89
|
1 |
|
public function getMercancias(): Mercancias |
90
|
|
|
{ |
91
|
1 |
|
return $this->helperGetOrAdd(new Mercancias()); |
|
|
|
|
92
|
|
|
} |
93
|
|
|
|
94
|
1 |
|
public function addMercancias(array $attributes = []): Mercancias |
95
|
|
|
{ |
96
|
1 |
|
$subject = $this->getMercancias(); |
97
|
1 |
|
$subject->addAttributes($attributes); |
98
|
1 |
|
return $subject; |
99
|
|
|
} |
100
|
|
|
} |
101
|
|
|
|