IdentifiableList::setId()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 6
c 0
b 0
f 0
ccs 0
cts 3
cp 0
rs 10
cc 1
nc 1
nop 1
crap 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
}