Code Duplication    Length = 15-15 lines in 6 locations

src/Model/Common/PriceCollection.php 1 location

@@ 15-29 (lines=15) @@
12
 * @method PriceCollection add(Price $element)
13
 * @method Price getAt($offset)
14
 */
15
class PriceCollection extends Collection
16
{
17
    protected $type = '\Commercetools\Core\Model\Common\Price';
18
19
    protected function indexRow($offset, $row)
20
    {
21
        $id = null;
22
        if ($row instanceof Price) {
23
            $id = $row->getId();
24
        } elseif (is_array($row)) {
25
            $id = isset($row[static::ID]) ? $row[static::ID] : null;
26
        }
27
        $this->addToIndex(static::ID, $offset, $id);
28
    }
29
}
30

src/Model/Order/DeliveryCollection.php 1 location

@@ 17-31 (lines=15) @@
14
 * @method DeliveryCollection add(Delivery $element)
15
 * @method Delivery getAt($offset)
16
 */
17
class DeliveryCollection extends Collection
18
{
19
    protected $type = '\Commercetools\Core\Model\Order\Delivery';
20
21
    protected function indexRow($offset, $row)
22
    {
23
        $id = null;
24
        if ($row instanceof Delivery) {
25
            $id = $row->getId();
26
        } elseif (is_array($row)) {
27
            $id = isset($row[static::ID]) ? $row[static::ID] : null;
28
        }
29
        $this->addToIndex(static::ID, $offset, $id);
30
    }
31
}
32

src/Model/Order/DeliveryItemCollection.php 1 location

@@ 17-31 (lines=15) @@
14
 * @method DeliveryItemCollection add(DeliveryItem $element)
15
 * @method DeliveryItem getAt($offset)
16
 */
17
class DeliveryItemCollection extends Collection
18
{
19
    protected $type = '\Commercetools\Core\Model\Order\DeliveryItem';
20
21
    protected function indexRow($offset, $row)
22
    {
23
        $id = null;
24
        if ($row instanceof DeliveryItem) {
25
            $id = $row->getId();
26
        } elseif (is_array($row)) {
27
            $id = isset($row[static::ID]) ? $row[static::ID] : null;
28
        }
29
        $this->addToIndex(static::ID, $offset, $id);
30
    }
31
}
32

src/Model/Order/ParcelCollection.php 1 location

@@ 17-31 (lines=15) @@
14
 * @method ParcelCollection add(Parcel $element)
15
 * @method Parcel getAt($offset)
16
 */
17
class ParcelCollection extends Collection
18
{
19
    protected $type = '\Commercetools\Core\Model\Order\Parcel';
20
21
    protected function indexRow($offset, $row)
22
    {
23
        $id = null;
24
        if ($row instanceof Parcel) {
25
            $id = $row->getId();
26
        } elseif (is_array($row)) {
27
            $id = isset($row[static::ID]) ? $row[static::ID] : null;
28
        }
29
        $this->addToIndex(static::ID, $offset, $id);
30
    }
31
}
32

src/Model/Order/ReturnItemCollection.php 1 location

@@ 17-31 (lines=15) @@
14
 * @method ReturnItemCollection add(ReturnItem $element)
15
 * @method ReturnItem getAt($offset)
16
 */
17
class ReturnItemCollection extends Collection
18
{
19
    protected $type = '\Commercetools\Core\Model\Order\ReturnItem';
20
21
    protected function indexRow($offset, $row)
22
    {
23
        $id = null;
24
        if ($row instanceof ReturnItem) {
25
            $id = $row->getId();
26
        } elseif (is_array($row)) {
27
            $id = isset($row[static::ID]) ? $row[static::ID] : null;
28
        }
29
        $this->addToIndex(static::ID, $offset, $id);
30
    }
31
}
32

src/Model/TaxCategory/TaxRateCollection.php 1 location

@@ 17-31 (lines=15) @@
14
 * @method TaxRateCollection add(TaxRate $element)
15
 * @method TaxRate getAt($offset)
16
 */
17
class TaxRateCollection extends Collection
18
{
19
    protected $type = '\Commercetools\Core\Model\TaxCategory\TaxRate';
20
21
    protected function indexRow($offset, $row)
22
    {
23
        $id = null;
24
        if ($row instanceof TaxRate) {
25
            $id = $row->getId();
26
        } elseif (is_array($row)) {
27
            $id = isset($row[static::ID]) ? $row[static::ID] : null;
28
        }
29
        $this->addToIndex(static::ID, $offset, $id);
30
    }
31
}
32