Code Duplication    Length = 7-7 lines in 3 locations

src/Shipment/Partial/Detail.php 3 locations

@@ 438-444 (lines=7) @@
435
        $result .= substr(str_pad($this->parcels->offsetGet(0)->getQuantity(), 2, Numeric::FILL, Numeric::ALIGN), 0, 2);
436
437
        // second parcel
438
        if ($this->parcels->offsetExists(1)) {
439
            $result .= substr(str_pad($this->parcels->offsetGet(1)->getPrice(), 10, Numeric::FILL, Numeric::ALIGN), 0, 10);
440
            $result .= substr(str_pad($this->parcels->offsetGet(1)->getQuantity(), 2, Numeric::FILL, Numeric::ALIGN), 0, 2);
441
        } else {
442
            $result .= substr(str_pad(0, 10, Numeric::FILL, Numeric::ALIGN), 0, 10);
443
            $result .= substr(str_pad(0, 2, Numeric::FILL, Numeric::ALIGN), 0, 2);
444
        }
445
446
        // third parcel
447
        if ($this->parcels->offsetExists(2)) {
@@ 447-453 (lines=7) @@
444
        }
445
446
        // third parcel
447
        if ($this->parcels->offsetExists(2)) {
448
            $result .= substr(str_pad($this->parcels->offsetGet(2)->getPrice(), 10, Numeric::FILL, Numeric::ALIGN), 0, 10);
449
            $result .= substr(str_pad($this->parcels->offsetGet(2)->getQuantity(), 2, Numeric::FILL, Numeric::ALIGN), 0, 2);
450
        } else {
451
            $result .= substr(str_pad(0, 10, Numeric::FILL, Numeric::ALIGN), 0, 10);
452
            $result .= substr(str_pad(0, 2, Numeric::FILL, Numeric::ALIGN), 0, 2);
453
        }
454
455
        // fourth parcel
456
        if ($this->parcels->offsetExists(3)) {
@@ 456-462 (lines=7) @@
453
        }
454
455
        // fourth parcel
456
        if ($this->parcels->offsetExists(3)) {
457
            $result .= substr(str_pad($this->parcels->offsetGet(3)->getPrice(), 10, Numeric::FILL, Numeric::ALIGN), 0, 10);
458
            $result .= substr(str_pad($this->parcels->offsetGet(3)->getQuantity(), 2, Numeric::FILL, Numeric::ALIGN), 0, 2);
459
        } else {
460
            $result .= substr(str_pad(0, 10, Numeric::FILL, Numeric::ALIGN), 0, 10);
461
            $result .= substr(str_pad(0, 2, Numeric::FILL, Numeric::ALIGN), 0, 2);
462
        }
463
464
        // authorization number
465
        $result .= substr(str_pad($this->authorization->getNumber(), 10, Alphanumeric::FILL, Alphanumeric::ALIGN), 0, 10);