|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Rougin\Windstorm\Eloquent; |
|
4
|
|
|
|
|
5
|
|
|
use Illuminate\Database\Eloquent\Builder; |
|
|
|
|
|
|
6
|
|
|
use Rougin\Windstorm\WhereInterface; |
|
7
|
|
|
|
|
8
|
|
|
class Where implements WhereInterface |
|
9
|
|
|
{ |
|
10
|
|
|
protected $builder; |
|
11
|
|
|
|
|
12
|
|
|
protected $method = 'where'; |
|
13
|
|
|
|
|
14
|
|
|
protected $query; |
|
15
|
|
|
|
|
16
|
|
|
protected $key; |
|
17
|
|
|
|
|
18
|
|
|
protected $type; |
|
19
|
|
|
|
|
20
|
|
|
public function __construct(Query $query, Builder $builder, $key, $type = 'and') |
|
21
|
|
|
{ |
|
22
|
|
|
$this->query = $query; |
|
23
|
|
|
|
|
24
|
|
|
$this->builder = $builder; |
|
25
|
|
|
|
|
26
|
|
|
$this->key = $key; |
|
27
|
|
|
|
|
28
|
|
|
$this->type = $type; |
|
29
|
|
|
} |
|
30
|
|
|
|
|
31
|
|
|
/** |
|
32
|
|
|
* Generates an equality comparison. |
|
33
|
|
|
* |
|
34
|
|
|
* @param mixed $value |
|
35
|
|
|
* @return \Rougin\Windstorm\QueryInterface |
|
36
|
|
|
*/ |
|
37
|
|
|
public function equals($value) |
|
38
|
|
|
{ |
|
39
|
|
|
return $this->where('=', $value); |
|
40
|
|
|
} |
|
41
|
|
|
|
|
42
|
|
|
/** |
|
43
|
|
|
* Generates an non-equality comparison. |
|
44
|
|
|
* |
|
45
|
|
|
* @param mixed $value |
|
46
|
|
|
* @return \Rougin\Windstorm\QueryInterface |
|
47
|
|
|
*/ |
|
48
|
|
|
public function notEqualTo($value) |
|
49
|
|
|
{ |
|
50
|
|
|
return $this->where('!=', $value); |
|
51
|
|
|
} |
|
52
|
|
|
|
|
53
|
|
|
/** |
|
54
|
|
|
* Generates a greater-than comparison. |
|
55
|
|
|
* |
|
56
|
|
|
* @param mixed $value |
|
57
|
|
|
* @return \Rougin\Windstorm\QueryInterface |
|
58
|
|
|
*/ |
|
59
|
|
|
public function greaterThan($value) |
|
60
|
|
|
{ |
|
61
|
|
|
return $this->where('>', $value); |
|
62
|
|
|
} |
|
63
|
|
|
|
|
64
|
|
|
/** |
|
65
|
|
|
* Generates a greater-than or an equality comparison. |
|
66
|
|
|
* |
|
67
|
|
|
* @param mixed $value |
|
68
|
|
|
* @return \Rougin\Windstorm\QueryInterface |
|
69
|
|
|
*/ |
|
70
|
|
|
public function greaterThanOrEqualTo($value) |
|
71
|
|
|
{ |
|
72
|
|
|
return $this->where('>=', $value); |
|
73
|
|
|
} |
|
74
|
|
|
|
|
75
|
|
|
/** |
|
76
|
|
|
* Generates an IN () query comparison. |
|
77
|
|
|
* |
|
78
|
|
|
* @param array $values |
|
79
|
|
|
* @return \Rougin\Windstorm\QueryInterface |
|
80
|
|
|
*/ |
|
81
|
|
|
public function in(array $values) |
|
82
|
|
|
{ |
|
83
|
|
|
$this->builder = $this->builder->whereIn($this->key, $values, $this->type); |
|
84
|
|
|
|
|
85
|
|
|
return $this->query->builder($this->builder); |
|
86
|
|
|
} |
|
87
|
|
|
|
|
88
|
|
|
/** |
|
89
|
|
|
* Generates an NOT IN () query comparison. |
|
90
|
|
|
* |
|
91
|
|
|
* @param array $values |
|
92
|
|
|
* @return \Rougin\Windstorm\QueryInterface |
|
93
|
|
|
*/ |
|
94
|
|
|
public function notIn(array $values) |
|
95
|
|
|
{ |
|
96
|
|
|
$this->builder = $this->builder->whereNotIn($this->key, $values, $this->type); |
|
97
|
|
|
|
|
98
|
|
|
return $this->query->builder($this->builder); |
|
99
|
|
|
} |
|
100
|
|
|
|
|
101
|
|
|
/** |
|
102
|
|
|
* Generates a false comparison. |
|
103
|
|
|
* |
|
104
|
|
|
* @return \Rougin\Windstorm\QueryInterface |
|
105
|
|
|
*/ |
|
106
|
|
|
public function isFalse() |
|
107
|
|
|
{ |
|
108
|
|
|
return $this->where('=', false); |
|
109
|
|
|
} |
|
110
|
|
|
|
|
111
|
|
|
/** |
|
112
|
|
|
* Generates an IS NOT NULL query comparison. |
|
113
|
|
|
* |
|
114
|
|
|
* @return \Rougin\Windstorm\QueryInterface |
|
115
|
|
|
*/ |
|
116
|
|
|
public function isNotNull() |
|
117
|
|
|
{ |
|
118
|
|
|
$this->builder = $this->builder->whereNotNull($this->key, $this->type); |
|
119
|
|
|
|
|
120
|
|
|
return $this->query->builder($this->builder); |
|
121
|
|
|
} |
|
122
|
|
|
|
|
123
|
|
|
/** |
|
124
|
|
|
* Generates an IS NULL query comparison. |
|
125
|
|
|
* |
|
126
|
|
|
* @return \Rougin\Windstorm\QueryInterface |
|
127
|
|
|
*/ |
|
128
|
|
|
public function isNull() |
|
129
|
|
|
{ |
|
130
|
|
|
$this->builder = $this->builder->whereNull($this->key, $this->type); |
|
131
|
|
|
|
|
132
|
|
|
return $this->query->builder($this->builder); |
|
133
|
|
|
} |
|
134
|
|
|
|
|
135
|
|
|
/** |
|
136
|
|
|
* Generates a true comparison. |
|
137
|
|
|
* |
|
138
|
|
|
* @return \Rougin\Windstorm\QueryInterface |
|
139
|
|
|
*/ |
|
140
|
|
|
public function isTrue() |
|
141
|
|
|
{ |
|
142
|
|
|
return $this->where('=', true); |
|
143
|
|
|
} |
|
144
|
|
|
|
|
145
|
|
|
/** |
|
146
|
|
|
* Generates a less-than comparison. |
|
147
|
|
|
* |
|
148
|
|
|
* @param mixed $value |
|
149
|
|
|
* @return \Rougin\Windstorm\QueryInterface |
|
150
|
|
|
*/ |
|
151
|
|
|
public function lessThan($value) |
|
152
|
|
|
{ |
|
153
|
|
|
return $this->where('<', true); |
|
154
|
|
|
} |
|
155
|
|
|
|
|
156
|
|
|
/** |
|
157
|
|
|
* Generates a less-than or an equality comparison. |
|
158
|
|
|
* |
|
159
|
|
|
* @param mixed $value |
|
160
|
|
|
* @return \Rougin\Windstorm\QueryInterface |
|
161
|
|
|
*/ |
|
162
|
|
|
public function lessThanOrEqualTo($value) |
|
163
|
|
|
{ |
|
164
|
|
|
return $this->where('<=', true); |
|
165
|
|
|
} |
|
166
|
|
|
|
|
167
|
|
|
/** |
|
168
|
|
|
* Generates a LIKE query comparison. |
|
169
|
|
|
* |
|
170
|
|
|
* @param string $value |
|
171
|
|
|
* @return \Rougin\Windstorm\QueryInterface |
|
172
|
|
|
*/ |
|
173
|
|
|
public function like($value) |
|
174
|
|
|
{ |
|
175
|
|
|
return $this->where('like', $value); |
|
176
|
|
|
} |
|
177
|
|
|
|
|
178
|
|
|
/** |
|
179
|
|
|
* Generates a NOT LIKE query comparison. |
|
180
|
|
|
* |
|
181
|
|
|
* @param string $value |
|
182
|
|
|
* @return \Rougin\Windstorm\QueryInterface |
|
183
|
|
|
*/ |
|
184
|
|
|
public function notLike($value) |
|
185
|
|
|
{ |
|
186
|
|
|
return $this->where('not like', $value); |
|
187
|
|
|
} |
|
188
|
|
|
|
|
189
|
|
|
protected function where($operator, $value) |
|
190
|
|
|
{ |
|
191
|
|
|
$method = (string) $this->method; |
|
192
|
|
|
|
|
193
|
|
|
$this->builder = $this->builder->$method($this->key, $operator, $value, $this->type); |
|
194
|
|
|
|
|
195
|
|
|
return $this->query->builder($this->builder); |
|
196
|
|
|
} |
|
197
|
|
|
} |
|
198
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths