Code Duplication    Length = 21-21 lines in 2 locations

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

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

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