PaymentTerms   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 20
dl 0
loc 41
rs 10
c 0
b 0
f 0
wmc 6

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A xmlSerialize() 0 14 3
A setPaymentDueDate() 0 4 1
A setAmount() 0 4 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 2021, Jaime Cruz
9
 */
10
11
namespace F72X\UblComponent;
12
13
use Sabre\Xml\Writer;
14
15
class PaymentTerms extends BaseComponent
16
{
17
18
    protected $ID;
19
    protected $PaymentMeansID;
20
    /** @var Amount */
21
    protected $Amount;
22
    protected $PaymentDueDate;
23
    public function __construct($ID, $PaymentMeansID)
24
    {
25
        $this->ID             = $ID;
26
        $this->PaymentMeansID = $PaymentMeansID;
27
    }
28
    function xmlSerialize(Writer $writer)
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
29
    {
30
        $writer->write([
31
            SchemaNS::CBC . 'ID'             => $this->ID,
32
            SchemaNS::CBC . 'PaymentMeansID' => $this->PaymentMeansID
33
        ]);
34
        if ($this->Amount) {
35
            $writer->write([
36
                $this->Amount
37
            ]);
38
        }
39
        if ($this->PaymentDueDate) {
40
            $writer->write([
41
                SchemaNS::CBC . 'PaymentDueDate' => $this->PaymentDueDate->format('Y-m-d')
42
            ]);
43
        }
44
    }
45
46
    public function setAmount($Amount)
47
    {
48
        $this->Amount = $Amount;
49
        return $this;
50
    }
51
52
    public function setPaymentDueDate($PaymentDueDate)
53
    {
54
        $this->PaymentDueDate = $PaymentDueDate;
55
        return $this;
56
    }
57
}
58