ReferenceNumber::fromXml()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 7

Duplication

Lines 10
Ratio 100 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 7
c 1
b 0
f 0
nc 1
nop 1
dl 10
loc 10
rs 9.4285
1
<?php namespace SimpleUPS\Track;
2
3
/**
4
 * Reference number for signifying PO #’s, Invoice #’s, etc
5
 * @since 1.0
6
 */
7 View Code Duplication
class ReferenceNumber extends \SimpleUPS\Model
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
8
{
9
    private
10
        /* @var integer $code */
11
        $code,
12
13
        /* @var string $value */
14
        $value;
15
16
    /**
17
     * @internal
18
     *
19
     * @param integer $code
20
     *
21
     * @return ReferenceNumber
22
     */
23
    public function setCode($code)
24
    {
25
        $this->code = (string)$code;
26
        return $this;
27
    }
28
29
    /**
30
     * Reference number type code, for signifying PO #’s, Invoice #’s, etc
31
     * @return integer
32
     */
33
    public function getCode()
34
    {
35
        return $this->code;
36
    }
37
38
    /**
39
     * @internal
40
     *
41
     * @param string $value
42
     *
43
     * @return ReferenceNumber
44
     */
45
    public function setValue($value)
46
    {
47
        $this->value = (string)$value;
48
        return $this;
49
    }
50
51
    /**
52
     * Customer supplied reference number
53
     * @return string
54
     */
55
    public function getValue()
56
    {
57
        return $this->value;
58
    }
59
60
    /**
61
     * @internal
62
     *
63
     * @param \SimpleXMLElement $xml
64
     *
65
     * @return ReferenceNumber
66
     */
67
    public static function fromXml(\SimpleXMLElement $xml)
68
    {
69
        $referenceNumber = new ReferenceNumber();
70
        $referenceNumber->setIsResponse();
71
        $referenceNumber
72
            ->setCode($xml->Code)
73
            ->setValue($xml->Value);
74
75
        return $referenceNumber;
76
    }
77
}
78