-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathIn.php
49 lines (43 loc) · 822 Bytes
/
In.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?php
namespace ModernPDO\Conditions;
/**
* In condition.
*/
class In extends Condition
{
/**
* In constructor.
*
* @param list<mixed> $values condition values
*/
public function __construct(
private array $values,
) {
}
/**
* Returns condition sign.
*/
public function buildSign(): string
{
return 'IN';
}
/**
* Returns prepared condition query.
*/
public function buildQuery(): string
{
if (empty($this->values)) {
return '';
}
return '(' . str_repeat('?, ', \count($this->values) - 1) . '?)';
}
/**
* Returns parameters for condition.
*
* @return list<mixed>
*/
public function buildParams(): array
{
return $this->values;
}
}