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