-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathDefaultConstraint.php
executable file
·64 lines (55 loc) · 1.33 KB
/
DefaultConstraint.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
53
54
55
56
57
58
59
60
61
62
63
64
<?php
namespace Unleash\Client\DTO;
use JetBrains\PhpStorm\ExpectedValues;
use Override;
use Unleash\Client\Enum\ConstraintOperator;
final readonly class DefaultConstraint implements Constraint
{
/**
* @param array<string> $values
*/
public function __construct(
private string $contextName,
#[ExpectedValues(valuesFromClass: ConstraintOperator::class)]
private string $operator,
private ?array $values = null,
private ?string $singleValue = null,
private bool $inverted = false,
private bool $caseInsensitive = false,
) {
}
#[Override]
public function getContextName(): string
{
return $this->contextName;
}
#[Override]
#[ExpectedValues(valuesFromClass: ConstraintOperator::class)]
public function getOperator(): string
{
return $this->operator;
}
/**
* @return array<string>|null
*/
#[Override]
public function getValues(): ?array
{
return $this->values;
}
#[Override]
public function getSingleValue(): ?string
{
return $this->singleValue;
}
#[Override]
public function isInverted(): bool
{
return $this->inverted;
}
#[Override]
public function isCaseInsensitive(): bool
{
return $this->caseInsensitive;
}
}