Code Duplication    Length = 21-21 lines in 2 locations

src/Bpost/Order/Box/At247.php 1 location

@@ 312-332 (lines=21) @@
309
                (string)$xml->{'at24-7'}->product
310
            );
311
        }
312
        if (isset($xml->{'at24-7'}->options)) {
313
            /** @var \SimpleXMLElement $optionData */
314
            foreach ($xml->{'at24-7'}->options as $optionData) {
315
                $optionData = $optionData->children('http://schema.post.be/shm/deepintegration/v3/common');
316
317
                if (in_array($optionData->getName(), array(Messaging::MESSAGING_TYPE_INFO_DISTRIBUTED))) {
318
                    $option = Messaging::createFromXML($optionData);
319
                } else {
320
                    $className = '\\Bpost\\BpostApiClient\\Bpost\\Order\\Box\\Option\\' . ucfirst($optionData->getName());
321
                    if (!method_exists($className, 'createFromXML')) {
322
                        throw new BpostNotImplementedException();
323
                    }
324
                    $option = call_user_func(
325
                        array($className, 'createFromXML'),
326
                        $optionData
327
                    );
328
                }
329
330
                $at247->addOption($option);
331
            }
332
        }
333
        if (isset($xml->{'at24-7'}->weight) && $xml->{'at24-7'}->weight != '') {
334
            $at247->setWeight(
335
                (int)$xml->{'at24-7'}->weight

src/Bpost/Order/Box/International.php 1 location

@@ 231-251 (lines=21) @@
228
                (string) $xml->international->product
229
            );
230
        }
231
        if (isset($xml->international->options)) {
232
            /** @var \SimpleXMLElement $optionData */
233
            foreach ($xml->international->options as $optionData) {
234
                $optionData = $optionData->children('http://schema.post.be/shm/deepintegration/v3/common');
235
236
                if (in_array($optionData->getName(), array(Messaging::MESSAGING_TYPE_INFO_DISTRIBUTED))) {
237
                    $option = Messaging::createFromXML($optionData);
238
                } else {
239
                    $className = '\\Bpost\\BpostApiClient\\Bpost\\Order\\Box\\Option\\' . ucfirst($optionData->getName());
240
                    if (!method_exists($className, 'createFromXML')) {
241
                        throw new BpostNotImplementedException();
242
                    }
243
                    $option = call_user_func(
244
                        array($className, 'createFromXML'),
245
                        $optionData
246
                    );
247
                }
248
249
                $international->addOption($option);
250
            }
251
        }
252
        if (isset($xml->international->parcelWeight) && $xml->international->parcelWeight != '') {
253
            $international->setParcelWeight(
254
                (int) $xml->international->parcelWeight