Code Duplication    Length = 71-81 lines in 3 locations

src/SimpleUPS/Track/ReferenceNumber.php 1 location

@@ 7-77 (lines=71) @@
4
 * Reference number for signifying PO #’s, Invoice #’s, etc
5
 * @since 1.0
6
 */
7
class ReferenceNumber extends \SimpleUPS\Model
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

src/SimpleUPS/Track/SmallPackage/Accessorial.php 1 location

@@ 6-76 (lines=71) @@
3
/**
4
 * @since 1.0
5
 */
6
class Accessorial extends \SimpleUPS\Model
7
{
8
9
    private
10
        /* @var string $code */
11
        $code,
12
13
        /* @var string $description */
14
        $description;
15
16
    /**
17
     * @internal
18
     *
19
     * @param string $code
20
     *
21
     * @return Accessorial
22
     */
23
    public function setCode($code)
24
    {
25
        $this->code = (string)$code;
26
        return $this;
27
    }
28
29
    /**
30
     * The code indicating accessorial for a given UPS World Wide Express Shipment.
31
     * @return string
32
     */
33
    public function getCode()
34
    {
35
        return $this->code;
36
    }
37
38
    /**
39
     * @internal
40
     *
41
     * @param string $description
42
     *
43
     * @return Accessorial
44
     */
45
    public function setDescription($description)
46
    {
47
        $this->description = (string)$description;
48
        return $this;
49
    }
50
51
    /**
52
     * @return string
53
     */
54
    public function getDescription()
55
    {
56
        return $this->description;
57
    }
58
59
    /**
60
     * @internal
61
     *
62
     * @param \SimpleXMLElement $xml
63
     *
64
     * @return Accessorial
65
     */
66
    public static function fromXml(\SimpleXMLElement $xml)
67
    {
68
        $accessorial = new Accessorial();
69
        $accessorial->setIsResponse();
70
        $accessorial
71
            ->setCode($xml->Code)
72
            ->setDescription($xml->Description);
73
74
        return $accessorial;
75
    }
76
}

src/SimpleUPS/Track/SmallPackage/ProductType.php 1 location

@@ 6-86 (lines=81) @@
3
/**
4
 * @since 1.0
5
 */
6
class ShipmentType extends \SimpleUPS\Model
7
{
8
9
    private
10
        /* @var string $code */
11
        $code,
12
13
        /* @var string $description */
14
        $description;
15
16
    /**
17
     * @internal
18
     *
19
     * @param string $code
20
     *
21
     * @return ShipmentType
22
     */
23
    public function setCode($code)
24
    {
25
        $this->code = (string)$code;
26
        return $this;
27
    }
28
29
    /**
30
     * Code indicating the type of the Product
31
     * @return string
32
     */
33
    public function getCode()
34
    {
35
        return $this->code;
36
    }
37
38
    /**
39
     * @internal
40
     *
41
     * @param string $description
42
     *
43
     * @return ShipmentType
44
     */
45
    public function setDescription($description)
46
    {
47
        $this->description = (string)$description;
48
        return $this;
49
    }
50
51
    /**
52
     * Description of the type of the Product.
53
     * Valid Value: “World Ease” (when a shipment with single/multiple packages is associated with World Ease movement).
54
     * @return string
55
     */
56
    public function getDescription()
57
    {
58
        return $this->description;
59
    }
60
61
    /**
62
     * @return bool
63
     */
64
    public function isWorldEase()
65
    {
66
        return $this->getDescription() == "World Ease";
67
    }
68
69
    /**
70
     * @internal
71
     *
72
     * @param \SimpleXMLElement $xml
73
     *
74
     * @return ProductType
75
     */
76
    public static function fromXml(\SimpleXMLElement $xml)
77
    {
78
        $productType = new ProductType();
79
        $productType->setIsResponse();
80
        $productType
81
            ->setCode($xml->Code)
82
            ->setDescription($xml->Description);
83
84
        return $productType;
85
    }
86
}