Code Duplication    Length = 12-15 lines in 3 locations

src/SimpleUPS/Service.php 1 location

@@ 142-153 (lines=12) @@
139
     *
140
     * @return Service
141
     */
142
    public static function fromXml(\SimpleXMLElement $xml)
143
    {
144
        $service = new Service();
145
        $service->setIsResponse();
146
        $service->setCode($xml->Code);
147
148
        if (isset($xml->Description)) {
149
            $service->setDescription($xml->Description);
150
        }
151
152
        return $service;
153
    }
154
}

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

@@ 95-109 (lines=15) @@
92
     *
93
     * @return Message
94
     */
95
    public static function fromXml(\SimpleXMLElement $xml)
96
    {
97
        $message = new Message();
98
        $message->setIsResponse();
99
100
        if (isset($xml->Code)) {
101
            $message->setCode($xml->Code);
102
        }
103
104
        if (isset($xml->Description)) {
105
            $message->setDescription($xml->Description);
106
        }
107
108
        return $message;
109
    }
110
}

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

@@ 113-127 (lines=15) @@
110
     *
111
     * @return StatusType
112
     */
113
    public static function fromXml(\SimpleXMLElement $xml)
114
    {
115
        $statusType = new StatusType();
116
        $statusType->setIsResponse();
117
118
        if (isset($xml->Code)) {
119
            $statusType->setCode((string)$xml->Code);
120
        }
121
122
        if (isset($xml->Description)) {
123
            $statusType->setDescription((string)$xml->Description);
124
        }
125
126
        return $statusType;
127
    }
128
}