ConditionSet.php
2.21 KB
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
<?php
/**
* @license GPL-2.0-or-later
*
* Modified by learndash on 20-September-2023 using Strauss.
* @see https://github.com/BrianHenryIE/strauss
*/
declare(strict_types=1);
namespace StellarWP\Learndash\StellarWP\FieldConditions\Contracts;
use Closure;
use IteratorAggregate;
use JsonSerializable;
/**
* @template C of Condition
*/
interface ConditionSet extends IteratorAggregate, JsonSerializable
{
/**
* Returns all conditions in the set.
*
* @since 1.0.0
*
* @return array<C>
*/
public function getConditions(): array;
/**
* Returns true if the set has conditions.
*
* @since 1.1.0
*/
public function hasConditions(): bool;
/**
* Add one or more conditions to the set;
*
* @since 1.0.0
*
* @param C ...$conditions
*
* @return void
*/
public function append(...$conditions);
/**
* @since 1.0.0
*
* @param string|C|Closure $condition
* @param string|null $comparisonOperator
* @param mixed|null $value
*/
public function where($condition, string $comparisonOperator = null, $value = null): self;
/**
* @since 1.0.0
*
* @param string|C|Closure $condition
* @param string|null $comparisonOperator
* @param mixed|null $value
*/
public function and($condition, string $comparisonOperator = null, $value = null): self;
/**
* @since 1.0.0
*
* @param string|C|Closure $condition
* @param string|null $comparisonOperator
* @param mixed|null $value
*/
public function or($condition, string $comparisonOperator = null, $value = null): self;
/**
* Returns true if all conditions in the set pass.
*
* @since 1.0.0
*
* @param array<string, mixed> $values
*/
public function passes(array $values): bool;
/**
* Returns true if any condition in the set fails.
*
* @since 1.0.0
*
* @param array<string, mixed> $values
*/
public function fails(array $values): bool;
/**
* Returns the conditions in array form for JSON serialization.
*
* @since 1.0.0
*
* @return list<array>
*/
public function jsonSerialize(): array;
}