Completed
Push — master ( 4b89b9...dd9abc )
by Jens
10:35
created

TaxRateCollection::indexRow()   A

Complexity

Conditions 4
Paths 4

Size

Total Lines 10
Code Lines 7

Duplication

Lines 10
Ratio 100 %

Code Coverage

Tests 8
CRAP Score 4

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 10
loc 10
ccs 8
cts 8
cp 1
rs 9.2
cc 4
eloc 7
nc 4
nop 2
crap 4
1
<?php
2
/**
3
 * @author @jayS-de <[email protected]>
4
 */
5
6
namespace Commercetools\Core\Model\TaxCategory;
7
8
use Commercetools\Core\Model\Common\Collection;
9
10
/**
11
 * @package Commercetools\Core\Model\TaxCategory
12
 * @link https://dev.commercetools.com/http-api-projects-taxCategories.html#tax-rate
13
 * @method TaxRate current()
14
 * @method TaxRateCollection add(TaxRate $element)
15
 * @method TaxRate getAt($offset)
16
 */
17 View Code Duplication
class TaxRateCollection extends Collection
0 ignored issues
show
Duplication introduced by
This class 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...
18
{
19
    protected $type = '\Commercetools\Core\Model\TaxCategory\TaxRate';
20
21 51
    protected function indexRow($offset, $row)
22
    {
23 51
        $id = null;
24 51
        if ($row instanceof TaxRate) {
25 51
            $id = $row->getId();
26 2
        } elseif (is_array($row)) {
27 2
            $id = isset($row[static::ID]) ? $row[static::ID] : null;
28
        }
29 51
        $this->addToIndex(static::ID, $offset, $id);
30 51
    }
31
}
32