Completed
Push — 2.0-dev ( 0f31c9...13891e )
by Takehiro
03:05
created

Lql::statsNegate()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 4
Bugs 0 Features 1
Metric Value
c 4
b 0
f 1
dl 0
loc 6
rs 9.4285
cc 1
eloc 3
nc 1
nop 0
1
<?php
2
namespace Kwkm\MkLiveStatusClient;
3
4
/**
5
 * Class Lql
6
 *
7
 * @package Kwkm\MkLiveStatusClient
8
 * @author Takehiro Kawakami <[email protected]>
9
 * @license MIT
10
 */
11
class Lql extends LqlAbstract
12
{
13
    /**
14
     * @var \Kwkm\MkLiveStatusClient\LqlObject
15
     */
16
    private $lqlObject;
17
18
    /**
19
     * @var string
20
     */
21
    private $table;
22
23
    /**
24
     * @var string
25
     */
26
    private $authUser;
27
28
    /**
29
     * 初期化
30
     *
31
     * @return \Kwkm\MkLiveStatusClient\Lql
32
     */
33 View Code Duplication
    public function reset()
0 ignored issues
show
Duplication introduced by
This method 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...
34
    {
35
        $this->lqlObject = new LqlObject();
36
        $this->lqlObject->setTable($this->table);
37
        if (!is_null($this->authUser)) {
38
            $this->lqlObject->setAuthUser($this->authUser);
39
        }
40
41
        return $this;
42
    }
43
44
    /**
45
     * 取得カラムの指定
46
     *
47
     * @param Column $column
48
     * @return \Kwkm\MkLiveStatusClient\Lql
49
     * @throw \InvalidArgumentException if the provided argument is not of type 'string'.
50
     */
51
    public function column(Column $column)
52
    {
53
        $this->lqlObject->setColumns($column->get());
54
55
        return $this;
56
    }
57
58
    /**
59
     * ヘッダ情報を取得するかの設定
60
     *
61
     * @param boolean $boolean
62
     * @return \Kwkm\MkLiveStatusClient\Lql
63
     * @throw \InvalidArgumentException if the provided argument is not of type 'boolean'.
64
     */
65
    public function headers($boolean)
66
    {
67
        $this->lqlObject->setHeader($boolean);
68
69
        return $this;
70
    }
71
72
    /**
73
     * 任意のフィルタ設定
74
     *
75
     * @param \Kwkm\MkLiveStatusClient\Filter $filter
76
     * @return \Kwkm\MkLiveStatusClient\Lql
77
     * @throw \InvalidArgumentException if the provided argument is not of type 'string'.
78
     */
79
    public function filter(Filter $filter)
80
    {
81
        $this->lqlObject->appendArrayQuery($filter->get());
82
83
        return $this;
84
    }
85
86
    /**
87
     * Stats の指定
88
     * @param \Kwkm\MkLiveStatusClient\Stats $stats
89
     * @return \Kwkm\MkLiveStatusClient\Lql
90
     * @throw \InvalidArgumentException if the provided argument is not of type 'string'.
91
     */
92
    public function stats(Stats $stats)
93
    {
94
        $this->lqlObject->appendArrayQuery($stats->get());
95
96
        return $this;
97
    }
98
99
    /**
100
     * StatsNegate の指定
101
     * @return \Kwkm\MkLiveStatusClient\Lql
102
     */
103
    public function statsNegate()
104
    {
105
        $this->lqlObject->appendNoValueQuery('StatsNegate');
106
107
        return $this;
108
    }
109
110
    /**
111
     * Negate の指定
112
     * @return \Kwkm\MkLiveStatusClient\Lql
113
     */
114
    public function negate()
115
    {
116
        $this->lqlObject->appendNoValueQuery('Negate');
117
118
        return $this;
119
    }
120
121
    /**
122
     * パラメータの指定
123
     * @param string $parameter
124
     * @return \Kwkm\MkLiveStatusClient\Lql
125
     * @throw \InvalidArgumentException if the provided argument is not of type 'string'.
126
     */
127
    public function parameter($parameter)
128
    {
129
        $this->lqlObject->appendParameter($parameter);
130
131
        return $this;
132
    }
133
134
    /**
135
     * OutputFormat の指定
136
     * @param string $outputFormat
137
     * @return \Kwkm\MkLiveStatusClient\Lql
138
     * @throw \InvalidArgumentException if the provided argument is not of type 'string'.
139
     */
140
    public function outputFormat($outputFormat)
141
    {
142
        $this->lqlObject->setOutputFormat($outputFormat);
143
144
        return $this;
145
    }
146
147
    /**
148
     * Limit の指定
149
     * @param integer $limit
150
     * @return \Kwkm\MkLiveStatusClient\Lql
151
     * @throw \InvalidArgumentException if the provided argument is not of type 'integer'.
152
     */
153
    public function limit($limit)
154
    {
155
        $this->lqlObject->setLimit($limit);
156
157
        return $this;
158
    }
159
160
    /**
161
     * Lqlの実行テキストの作成
162
     * @return string
163
     */
164
    public function build()
165
    {
166
        return $this->lqlObject->build();
167
    }
168
169
    /**
170
     * コンストラクタ
171
     */
172
    public function __construct($table, $authUser = null)
173
    {
174
        $this->table = $table;
175
        $this->authUser = $authUser;
176
        $this->reset();
177
    }
178
}