-
Notifications
You must be signed in to change notification settings - Fork 0
/
Between.php
52 lines (47 loc) · 860 Bytes
/
Between.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
50
51
52
<?php
namespace ModernPDO\Conditions;
/**
* Between condition.
*/
class Between extends Condition
{
/**
* Between constructor.
*
* @template T
*
* @param T $min minimum condition value
* @param T $max maximum condition value
*/
public function __construct(
private mixed $min,
private mixed $max,
) {
}
/**
* Returns condition sign.
*/
public function buildSign(): string
{
return 'BETWEEN';
}
/**
* Returns prepared condition query.
*/
public function buildQuery(): string
{
return '? AND ?';
}
/**
* Returns parameters for condition.
*
* @return list<mixed>
*/
public function buildParams(): array
{
return [
$this->min,
$this->max,
];
}
}