ReadOffersBuilder::mainFilterItem()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 2
dl 0
loc 5
c 0
b 0
f 0
ccs 3
cts 3
cp 1
rs 10
cc 1
nc 1
nop 1
crap 1
1
<?php
2
3
namespace linkprofit\Tracker\builder;
4
5
use linkprofit\Tracker\request\ReadOffersQuery;
6
7
/**
8
 * Class ReadOffersBuilder
9
 *
10
 * @package linkprofit\Tracker\filter
11
 */
12
class ReadOffersBuilder extends BaseBuilder
13
{
14
    /**
15
     * @return ReadOffersQuery
16
     */
17 8
    public function createRoute()
18
    {
19 8
        $route = new ReadOffersQuery();
20 8
        $route->setActiveFilters($this->toArray());
21
22 8
        return $route;
23
    }
24
25
    /**
26
     * @param $id
27
     *
28
     * @return $this
29
     */
30 8
    public function categoryId($id)
31
    {
32 8
        $this->params['categoryId'] = $id;
33
34 8
        return $this;
35
    }
36
37
    /**
38
     * @return $this
39
     */
40 3
    public function isActive()
41
    {
42 3
        $this->params['active'] = 1;
43
44 3
        return $this;
45
    }
46
47
    /**
48
     * @param $limit
49
     *
50
     * @return $this
51
     */
52 8
    public function limit($limit)
53
    {
54 8
        $this->params['limit'] = $limit;
55
56 8
        return $this;
57
    }
58
59
    /**
60
     * @param $offset
61
     *
62
     * @return $this
63
     */
64 8
    public function offset($offset)
65
    {
66 8
        $this->params['offset'] = $offset;
67
68 8
        return $this;
69
    }
70
71
    /**
72
     * @param $field
73
     *
74
     * @return $this
75
     */
76 2
    public function orderByField($field)
77
    {
78 2
        $this->params['orderByField'] = $field;
79
80 2
        return $this;
81
    }
82
83
    /**
84
     * @param $id
85
     *
86
     * @return $this
87
     */
88 1
    public function merchantManagerId($id)
89
    {
90 1
        $this->params['merchantManagerId'] = $id;
91
92 1
        return $this;
93
    }
94
95
    /**
96
     * Like поиск по полям, поля не указываются
97
     *
98
     * @param string $term
99
     *
100
     * @return $this
101
     */
102 1
    public function mainFilterItem($term)
103
    {
104 1
        $this->params['mainFilterItem'] = (string) $term;
105
106 1
        return $this;
107
    }
108
}
109