PluginProbe
GiveWP – Donation Plugin and Fundraising Platform / 4.17.0
GiveWP – Donation Plugin and Fundraising Platform v4.17.0
4.17.0 4.16.9 4.16.8.1 4.16.8 4.16.7.2 4.16.7.1 4.16.7 4.16.6.1 4.16.6 4.16.5.1 4.16.5 4.16.4 4.16.3 4.16.2 4.16.1 4.16.0 4.15.5 4.15.4 4.15.3 4.15.2 4.15.1 4.15.0 2.3.0 2.3.1 2.3.2 All 256 releases
give / vendor / vendor-prefixed / stellarwp / field-conditions / src / ComplexConditionSet.php

ComplexConditionSet.php in GiveWP – Donation Plugin and Fundraising Platform 4.17.0, at vendor/vendor-prefixed/stellarwp/field-conditions/src/ComplexConditionSet.php

56 lines 1.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 declare(strict_types=1);
4
5 namespace Give\Vendors\StellarWP\FieldConditions;
6
7 use ArrayIterator;
8 use Give\Vendors\StellarWP\FieldConditions\Concerns\HasConditions;
9 use Give\Vendors\StellarWP\FieldConditions\Contracts\Condition;
10 use Give\Vendors\StellarWP\FieldConditions\Contracts\ConditionSet;
11
12 /**
13 * @implements ConditionSet<Condition>
14 * @uses HasConditions<Condition>
15 */
16 class ComplexConditionSet implements ConditionSet
17 {
18 use HasConditions;
19
20 /**
21 * @since 1.0.0
22 *
23 * @param Condition ...$conditions
24 */
25 public function __construct(...$conditions)
26 {
27 $this->validateConditions($conditions);
28 $this->conditions = $conditions;
29 }
30
31 /**
32 * @inheritDoc
33 *
34 * @since 1.0.0
35 */
36 public function getIterator(): ArrayIterator
37 {
38 return new ArrayIterator($this->conditions);
39 }
40
41 /**
42 * @inheritDoc
43 *
44 * @since 1.0.0
45 */
46 public function jsonSerialize(): array
47 {
48 return array_map(
49 static function (Condition $condition) {
50 return $condition->jsonSerialize();
51 },
52 $this->conditions
53 );
54 }
55 }
56