Test Failed
Push — master ( 1f5d45...b072a0 )
by JAIME ELMER
04:15
created

RequestedMonetaryTotal   A

Complexity

Total Complexity 13

Size/Duplication

Total Lines 93
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 45
dl 0
loc 93
rs 10
c 0
b 0
f 0
wmc 13

13 Methods

Rating   Name   Duplication   Size   Complexity  
A getCurrencyID() 0 2 1
A getAllowanceTotalAmount() 0 2 1
A setAllowanceTotalAmount() 0 3 1
A getLineExtensionAmount() 0 2 1
A setPayableAmount() 0 3 1
A setCurrencyID() 0 3 1
A getTaxInclusiveAmount() 0 2 1
A setLineExtensionAmount() 0 3 1
A setValidations() 0 3 1
A getPayableAmount() 0 2 1
A xmlSerialize() 0 22 1
A setTaxInclusiveAmount() 0 3 1
A getValidations() 0 2 1
1
<?php
2
3
/**
4
 * MÓDULO DE EMISIÓN ELECTRÓNICA F72X
5
 * UBL 2.1
6
 * Version 1.1
7
 * 
8
 * Copyright 2018, Jaime Cruz
9
 */
10
11
namespace F72X\UblComponent;
12
13
use F72X\Sunat\Operations;
14
use Sabre\Xml\Writer;
15
16
class RequestedMonetaryTotal extends BaseComponent {
17
18
    const DECIMALS = 2;
19
20
    protected $currencyID;
21
    protected $LineExtensionAmount;
22
    protected $TaxInclusiveAmount;
23
    protected $AllowanceTotalAmount;
24
    protected $PayableAmount;
25
    protected $validations = [
26
        'currencyID',
27
        'LineExtensionAmount',
28
        'TaxInclusiveAmount',
29
        'AllowanceTotalAmount',
30
        'PayableAmount'
31
    ];
32
    function xmlSerialize(Writer $writer) {
33
        $this->validate();
34
        $writer->write([
35
            [
36
                'name'  => SchemaNS::CBC . 'LineExtensionAmount',
37
                'value' => Operations::formatAmount($this->LineExtensionAmount, self::DECIMALS),
38
                'attributes' => ['currencyID' => $this->currencyID]
39
            ],
40
            [
41
                'name'  => SchemaNS::CBC . 'TaxInclusiveAmount',
42
                'value' => Operations::formatAmount($this->TaxInclusiveAmount, self::DECIMALS),
43
                'attributes' => ['currencyID' => $this->currencyID]
44
            ],
45
            [
46
                'name' => SchemaNS::CBC . 'AllowanceTotalAmount',
47
                'value' => Operations::formatAmount($this->AllowanceTotalAmount, self::DECIMALS),
48
                'attributes' => ['currencyID' => $this->currencyID]
49
            ],
50
            [
51
                'name' => SchemaNS::CBC . 'PayableAmount',
52
                'value' => Operations::formatAmount($this->PayableAmount, self::DECIMALS),
53
                'attributes' => ['currencyID' => $this->currencyID]
54
            ],
55
        ]);
56
    }
57
    public function getCurrencyID() {
58
        return $this->currencyID;
59
    }
60
61
    public function setCurrencyID($currencyID) {
62
        $this->currencyID = $currencyID;
63
        return $this;
64
    }
65
66
    public function getLineExtensionAmount() {
67
        return $this->LineExtensionAmount;
68
    }
69
70
    public function setLineExtensionAmount($LineExtensionAmount) {
71
        $this->LineExtensionAmount = $LineExtensionAmount;
72
        return $this;
73
    }
74
75
    public function getTaxInclusiveAmount() {
76
        return $this->TaxInclusiveAmount;
77
    }
78
79
    public function setTaxInclusiveAmount($TaxInclusiveAmount) {
80
        $this->TaxInclusiveAmount = $TaxInclusiveAmount;
81
        return $this;
82
    }
83
84
    public function getAllowanceTotalAmount() {
85
        return $this->AllowanceTotalAmount;
86
    }
87
88
    public function setAllowanceTotalAmount($AllowanceTotalAmount) {
89
        $this->AllowanceTotalAmount = $AllowanceTotalAmount;
90
        return $this;
91
    }
92
93
    public function getPayableAmount() {
94
        return $this->PayableAmount;
95
    }
96
97
    public function setPayableAmount($PayableAmount) {
98
        $this->PayableAmount = $PayableAmount;
99
        return $this;
100
    }
101
102
    public function getValidations() {
103
        return $this->validations;
104
    }
105
106
    public function setValidations($validations) {
107
        $this->validations = $validations;
108
        return $this;
109
    }
110
111
}
112