-
-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathInt4RangeValue.php
More file actions
35 lines (28 loc) · 877 Bytes
/
Copy pathInt4RangeValue.php
File metadata and controls
35 lines (28 loc) · 877 Bytes
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
<?php
declare(strict_types=1);
namespace Yiisoft\Db\Pgsql\Expression;
use Yiisoft\Db\Expression\ExpressionInterface;
final class Int4RangeValue implements ExpressionInterface
{
public function __construct(
public readonly ?int $lower = null,
public readonly ?int $upper = null,
public readonly bool $includeLower = true,
public readonly bool $includeUpper = true,
) {}
/**
* Returns the lower and upper bounds of a range, inclusive.
*
* @psalm-return array{0: ?int, 1: ?int}
*/
public function getBounds(): array
{
$lower = $this->lower === null || $this->includeLower
? $this->lower
: $this->lower + 1;
$upper = $this->upper === null || $this->includeUpper
? $this->upper
: $this->upper - 1;
return [$lower, $upper];
}
}