CustomerPackStation::getOrderNumber()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
namespace Bpost\BpostApiClient\Bpack247;
3
4
/**
5
 * bPost Customer Pack Station class
6
 *
7
 * @author Tijs Verkoyen <[email protected]>
8
 */
9
class CustomerPackStation
10
{
11
    /**
12
     * @var string
13
     */
14
    private $customLabel;
15
16
    /**
17
     * @var string
18
     */
19
    private $orderNumber;
20
21
    /**
22
     * @var string
23
     */
24
    private $packstationId;
25
26
    /**
27
     * @param string $customLabel
28
     */
29 1
    public function setCustomLabel($customLabel)
30
    {
31 1
        $this->customLabel = $customLabel;
32 1
    }
33
34
    /**
35
     * @return string
36
     */
37 1
    public function getCustomLabel()
38
    {
39 1
        return $this->customLabel;
40
    }
41
42
    /**
43
     * @param string $orderNumber
44
     */
45 2
    public function setOrderNumber($orderNumber)
46
    {
47 2
        $this->orderNumber = $orderNumber;
48 2
    }
49
50
    /**
51
     * @return string
52
     */
53 2
    public function getOrderNumber()
54
    {
55 2
        return $this->orderNumber;
56
    }
57
58
    /**
59
     * @param string $packstationId
60
     */
61 2
    public function setPackstationId($packstationId)
62
    {
63 2
        $this->packstationId = $packstationId;
64 2
    }
65
66
    /**
67
     * @return string
68
     */
69 2
    public function getPackstationId()
70
    {
71 2
        return $this->packstationId;
72
    }
73
74
    /**
75
     * @param  \SimpleXMLElement   $xml
76
     * @return CustomerPackStation
77
     */
78 2
    public static function createFromXML(\SimpleXMLElement $xml)
79
    {
80 2
        $packStation = new CustomerPackStation();
81
82 2
        if (isset($xml->OrderNumber) && $xml->OrderNumber != '') {
83 2
            $packStation->setOrderNumber((string) $xml->OrderNumber);
84 2
        }
85 2
        if (isset($xml->CustomLabel) && $xml->CustomLabel != '') {
86 1
            $packStation->setCustomLabel((string) $xml->CustomLabel);
87 1
        }
88 2
        if (isset($xml->PackstationID) && $xml->PackstationID != '') {
89 2
            $packStation->setPackstationId((string) $xml->PackstationID);
90 2
        }
91
92 2
        return $packStation;
93
    }
94
}
95