Price::setPriceAmount()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 3
rs 10
c 1
b 0
f 0
1
<?php
2
3
/**
4
 * MÓDULO DE EMISIÓN ELECTRÓNICA F72X
5
 * UBL 2.1
6
 * Version 1.0
7
 * 
8
 * Copyright 2019, Jaime Cruz
9
 */
10
11
namespace F72X\UblComponent;
12
13
use F72X\Sunat\Operations;
14
use Sabre\Xml\Writer;
15
16
class Price extends BaseComponent {
17
    
18
    const DECIMALS = 2;
19
20
    protected $currencyID;
21
    protected $PriceAmount;
22
23
    protected $validations = ['currencyID', 'PriceAmount'];
24
25
26
    function xmlSerialize(Writer $writer) {
27
        $this->validate();
28
29
        $writer->write([
30
            [
31
                'name'  => SchemaNS::CBC . 'PriceAmount',
32
                'value' => Operations::formatAmount($this->PriceAmount, self::DECIMALS),
33
                'attributes' => [
34
                    'currencyID' => $this->currencyID
35
                ]
36
            ],
37
        ]);
38
39
    }
40
41
    public function getCurrencyID() {
42
        return $this->currencyID;
43
    }
44
45
    public function setCurrencyID($currencyID) {
46
        $this->currencyID = $currencyID;
47
        return $this;
48
    }
49
50
    public function getPriceAmount() {
51
        return $this->PriceAmount;
52
    }
53
54
    public function setPriceAmount($PriceAmount) {
55
        $this->PriceAmount = $PriceAmount;
56
        return $this;
57
    }
58
59
}
60