PluginProbe
Content Control – The Ultimate Content Restriction Plugin! Restrict Content, Create Conditional Blocks & More / 2.6.1
Content Control – The Ultimate Content Restriction Plugin! Restrict Content, Create Conditional Blocks & More v2.6.1
trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.1.10 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.1.7 1.1.8 2.0.0 2.0.1 2.0.10 2.0.11 2.0.12 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 All 47 releases
content-control / classes / Models / RuleEngine / Set.php

Set.php in Content Control – The Ultimate Content Restriction Plugin! Restrict Content, Create Conditional Blocks & More 2.6.1, at classes/Models/RuleEngine/Set.php

94 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Rule engine set model.
4 *
5 * @package ContentControl
6 * @subpackage Models
7 */
8
9 namespace ContentControl\Models\RuleEngine;
10
11 /**
12 * Handler for condition sets.
13 *
14 * @package ContentControl
15 */
16 class Set {
17
18 /**
19 * Set id.
20 *
21 * @var string
22 */
23 public $id;
24
25 /**
26 * Set label.
27 *
28 * @var string
29 */
30 public $label;
31
32 /**
33 * Set query.
34 *
35 * @var Query
36 */
37 public $query;
38
39 /**
40 * Build a set.
41 *
42 * @param array{id:string,label:string,query:array<mixed>} $set Set data.
43 */
44 public function __construct( $set ) {
45 $set = wp_parse_args( $set, [
46 'id' => '',
47 'label' => '',
48 'query' => [],
49 ]);
50
51 $this->id = $set['id'];
52 $this->label = $set['label'];
53 $this->query = new Query( $set['query'] );
54 }
55
56 /**
57 * Check if this set has JS based rules.
58 *
59 * @return bool
60 */
61 public function has_js_rules() {
62 return $this->query->has_js_rules();
63 }
64
65 /**
66 * Check this sets rules.
67 *
68 * @return bool
69 */
70 public function check_rules() {
71 return $this->query->check_rules();
72 }
73
74 /**
75 * Get the check array for further post processing.
76 *
77 * @return array<bool|null|array<bool|null>>
78 */
79 public function get_checks() {
80 return $this->query->get_checks();
81 }
82
83 /**
84 * Return the checks as an array of information.
85 *
86 * Useful for debugging.
87 *
88 * @return array<string,mixed>
89 */
90 public function get_check_info() {
91 return $this->query->get_check_info();
92 }
93 }
94