PluginProbe
Content Control – The Ultimate Content Restriction Plugin! Restrict Content, Create Conditional Blocks & More / trunk
Content Control – The Ultimate Content Restriction Plugin! Restrict Content, Create Conditional Blocks & More vtrunk
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 / Group.php

Group.php in Content Control – The Ultimate Content Restriction Plugin! Restrict Content, Create Conditional Blocks & More trunk, at classes/Models/RuleEngine/Group.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 group model.
4 *
5 * @package ContentControl
6 * @subpackage Models
7 */
8
9 namespace ContentControl\Models\RuleEngine;
10
11 /**
12 * Handler for condition groups.
13 *
14 * @package ContentControl
15 */
16 class Group extends Item {
17
18 /**
19 * Group id.
20 *
21 * @var string
22 */
23 public $id;
24
25 /**
26 * Group label.
27 *
28 * @var string
29 */
30 public $label;
31
32 /**
33 * Group query.
34 *
35 * @var Query
36 */
37 public $query;
38
39 /**
40 * Build a group.
41 *
42 * @param array{id:string,label:string,query:array<mixed>} $group Group data.
43 */
44 public function __construct( $group ) {
45 $group = wp_parse_args( $group, [
46 'id' => '',
47 'label' => '',
48 'query' => [],
49 ]);
50
51 $this->id = $group['id'];
52 $this->label = $group['label'];
53 $this->query = new Query( $group['query'] );
54 }
55
56 /**
57 * Check if this group 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 groups rules.
67 *
68 * @return bool
69 */
70 public function check_rules() {
71 return $this->query->check_rules();
72 }
73
74 /**
75 * Check this groups rules.
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 rule check as an array of information.
85 *
86 * Useful for debugging.
87 *
88 * @return array<mixed>
89 */
90 public function get_check_info() {
91 return $this->query->get_check_info();
92 }
93 }
94