Completed
Push — develop ( b37c60...7b776f )
by
unknown
42:54 queued 11:25
created

AddressCollection   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 77.78%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 3
c 1
b 0
f 1
lcom 0
cbo 2
dl 0
loc 25
ccs 7
cts 9
cp 0.7778
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A indexRow() 0 9 2
A getById() 0 4 1
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
 * @method Address current()
11
 * @method AddressCollection add(Address $element)
12
 * @method Address getAt($offset)
13
 */
14
class AddressCollection extends Collection
15
{
16
    const ID = 'id';
17
18
    protected $type = '\Commercetools\Core\Model\Common\Address';
19
20 2
    protected function indexRow($offset, $row)
21
    {
22 2
        if ($row instanceof Address) {
23
            $name = $row->getId();
24
        } else {
25 2
            $name = $row[static::ID];
26
        }
27 2
        $this->addToIndex(static::ID, $offset, $name);
28 2
    }
29
30
    /**
31
     * @param $id
32
     * @return Address|null
33
     */
34 2
    public function getById($id)
35
    {
36 2
        return $this->getBy(static::ID, $id);
37
    }
38
}
39