Completed
Push — master ( 752fc6...dd10bc )
by Carlos C
31s queued 14s
created

Pagos::getChildrenOrder()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 5
rs 10
1
<?php
2
3
namespace CfdiUtils\Elements\Pagos20;
4
5
use CfdiUtils\Elements\Common\AbstractElement;
6
7
class Pagos extends AbstractElement
8
{
9
    public function getElementName(): string
10
    {
11
        return 'pago20:Pagos';
12
    }
13
14
    public function getChildrenOrder(): array
15
    {
16
        return [
17
        'pago20:Totales',
18
        'pago20:Pago',
19
        ];
20
    }
21
22
    public function getFixedAttributes(): array
23
    {
24
        return [
25
            'xmlns:pago20' => 'http://www.sat.gob.mx/Pagos20',
26
            'xsi:schemaLocation' => 'http://www.sat.gob.mx/Pagos20'
27
                . ' http://www.sat.gob.mx/sitio_internet/cfd/Pagos/Pagos20.xsd',
28
            'Version' => '2.0',
29
        ];
30
    }
31
32
    public function getTotales(): Totales
33
    {
34
        return $this->helperGetOrAdd(new Totales());
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->helperGetO...ents\Pagos20\Totales()) could return the type CfdiUtils\Elements\Pagos20\Pagos which is incompatible with the type-hinted return CfdiUtils\Elements\Pagos20\Totales. Consider adding an additional type-check to rule them out.
Loading history...
35
    }
36
37
    public function addTotales(array $attributes = []): Totales
38
    {
39
        $subject = $this->getTotales();
40
        $subject->addAttributes($attributes);
41
        return $subject;
42
    }
43
44
    public function addPago(array $attributes = []): Pago
45
    {
46
        $subject = new Pago($attributes);
47
        $this->addChild($subject);
48
        return $subject;
49
    }
50
51
    public function multiPago(array ...$elementAttributes): self
52
    {
53
        foreach ($elementAttributes as $attributes) {
54
            $this->addPago($attributes);
55
        }
56
        return $this;
57
    }
58
}
59