Code Duplication    Length = 7-7 lines in 2 locations

src/Model/ProductType/ProductTypeCollection.php 1 location

@@ 25-31 (lines=7) @@
22
23
    protected function indexRow($offset, $row)
24
    {
25
        if ($row instanceof ProductType) {
26
            $id = $row->getId();
27
            $name = $row->getName();
28
        } else {
29
            $id = isset($row[static::ID]) ? $row[static::ID] : null;
30
            $name = isset($row[static::NAME]) ? $row[static::NAME] : null;
31
        }
32
        $this->addToIndex(static::ID, $offset, $id);
33
        $this->addToIndex(static::NAME, $offset, $name);
34
    }

src/Model/ShippingMethod/ShippingMethodCollection.php 1 location

@@ 26-32 (lines=7) @@
23
24
    protected function indexRow($offset, $row)
25
    {
26
        if ($row instanceof ShippingMethod) {
27
            $name = $row->getName();
28
            $id = $row->getId();
29
        } else {
30
            $name = isset($row[static::NAME]) ? $row[static::NAME] : null;
31
            $id = isset($row[static::ID]) ? $row[static::ID] : null;
32
        }
33
        if (!empty($name)) {
34
            $this->addToIndex(static::NAME, $offset, $name);
35
        }