Code Duplication    Length = 14-14 lines in 2 locations

src/Model/Common/AddressCollection.php 1 location

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

src/Model/Product/ProductProjectionCollection.php 1 location

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