Code Duplication    Length = 15-15 lines in 7 locations

src/Core/Model/Common/AssetCollection.php 1 location

@@ 16-30 (lines=15) @@
13
 * @method Asset getAt($offset)
14
 * @method Asset getById($offset)
15
 */
16
class AssetCollection extends Collection
17
{
18
    protected $type = Asset::class;
19
20
    protected function indexRow($offset, $row)
21
    {
22
        $id = null;
23
        if ($row instanceof Asset) {
24
            $id = $row->getId();
25
        } elseif (is_array($row)) {
26
            $id = isset($row[static::ID]) ? $row[static::ID] : null;
27
        }
28
        $this->addToIndex(static::ID, $offset, $id);
29
    }
30
}
31

src/Core/Model/Common/PriceCollection.php 1 location

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

src/Core/Model/Order/DeliveryCollection.php 1 location

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

src/Core/Model/Order/DeliveryItemCollection.php 1 location

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

src/Core/Model/Order/ParcelCollection.php 1 location

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

src/Core/Model/Order/ReturnItemCollection.php 1 location

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

src/Core/Model/TaxCategory/TaxRateCollection.php 1 location

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