Completed
Push — develop ( c6f9f9...59e20d )
by Jens
09:32
created

PriceCollection::indexRow()   A

Complexity

Conditions 4
Paths 4

Size

Total Lines 10
Code Lines 7

Duplication

Lines 10
Ratio 100 %

Code Coverage

Tests 7
CRAP Score 4.0312

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 10
loc 10
ccs 7
cts 8
cp 0.875
rs 9.2
cc 4
eloc 7
nc 4
nop 2
crap 4.0312
1
<?php
2
/**
3
 * @author @jayS-de <[email protected]>
4
 */
5
6
namespace Commercetools\Core\Model\Common;
7
8
/**
9
 * @package Commercetools\Core\Model\Common
10
 * @link https://dev.commercetools.com/http-api-projects-products.html#product-price
11
 * @method Price current()
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 6 View Code Duplication
    protected function indexRow($offset, $row)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
20
    {
21 6
        $id = null;
22 6
        if ($row instanceof Price) {
23
            $id = $row->getId();
24 6
        } elseif (is_array($row)) {
25 6
            $id = isset($row[static::ID]) ? $row[static::ID] : null;
26
        }
27 6
        $this->addToIndex(static::ID, $offset, $id);
28 6
    }
29
}
30