IdentifiableList   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 37.5%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 0
dl 0
loc 33
c 0
b 0
f 0
ccs 3
cts 8
cp 0.375
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setId() 0 6 1
A addIdToQuery() 0 8 2
1
<?php
2
3
namespace linkprofit\AmoCRM\traits;
4
5
/**
6
 * Trait IdentifiableList
7
 * @package linkprofit\AmoCRM\traits
8
 */
9
trait IdentifiableList
10
{
11
    /**
12
     * @var int
13
     */
14
    protected $listId;
15
16
    /**
17
     * @param $id
18
     *
19
     * @return $this
20
     */
21
    public function setId($id)
22
    {
23
        $this->listId = $id;
24
25
        return $this;
26
    }
27
28
    /**
29
     * @param array $query
30
     *
31
     * @return array
32
     */
33 2
    public function addIdToQuery($query = [])
34
    {
35 2
        if ($this->listId !== null) {
36
            $query['id'] = $this->listId;
37
        }
38
39 2
        return $query;
40
    }
41
}