1 | <?php |
||
19 | class WordPoints_Hook_Event_Args extends WordPoints_Entity_Hierarchy { |
||
20 | |||
21 | /** |
||
22 | * Whether the event is repeatable. |
||
23 | * |
||
24 | * @since 1.0.0 |
||
25 | * |
||
26 | * @var bool |
||
27 | */ |
||
28 | protected $is_repeatable = true; |
||
29 | |||
30 | /** |
||
31 | * The slug of the primary arg for this event, if it has one. |
||
32 | * |
||
33 | * @since 1.0.0 |
||
34 | * |
||
35 | * @var string|false |
||
36 | */ |
||
37 | protected $primary_arg_slug = false; |
||
38 | |||
39 | /** |
||
40 | * The validator associated with the current hook reaction. |
||
41 | * |
||
42 | * @since 1.0.0 |
||
43 | * |
||
44 | * @var WordPoints_Hook_Reaction_Validator |
||
45 | */ |
||
46 | protected $validator; |
||
47 | |||
48 | /** |
||
49 | * Whether to push fields onto the validator when we descend into the hierarchy. |
||
50 | * |
||
51 | * This will usually be true, however, when we are getting a value from the |
||
52 | * hierarchy, we aren't actually descending into a sub-field, but descending |
||
53 | * down the arg hierarchy stored within a field. |
||
54 | * |
||
55 | * @since 1.0.0 |
||
56 | * |
||
57 | * @var bool |
||
58 | */ |
||
59 | protected $push_on_descend = true; |
||
60 | |||
61 | /** |
||
62 | * Construct the object with the arg objects. |
||
63 | * |
||
64 | * @param WordPoints_Hook_Arg[] $args The hook args. |
||
65 | */ |
||
66 | public function __construct( array $args ) { |
||
88 | |||
89 | /** |
||
90 | * Whether the event is repeatable. |
||
91 | * |
||
92 | * An event is repeatable if none of its args have their status toggled by the |
||
93 | * event. In that case, it is possible for the event to occur with those same args |
||
94 | * multiple times in a row without being reversed in between. |
||
95 | * |
||
96 | * An arg that has its status modified is called a signature arg. One that does |
||
97 | * not is called a stateful arg. An event is repeatable if it has no signature |
||
98 | * args, only stateful ones. |
||
99 | * |
||
100 | * @since 1.0.0 |
||
101 | * |
||
102 | * @return bool Whether the event is repeatable. |
||
103 | */ |
||
104 | public function is_event_repeatable() { |
||
107 | |||
108 | /** |
||
109 | * Get the stateful args for this event. |
||
110 | * |
||
111 | * @since 1.0.0 |
||
112 | * |
||
113 | * @return WordPoints_Entity[] The entity objects for the stateful args. |
||
114 | */ |
||
115 | public function get_stateful_args() { |
||
125 | |||
126 | /** |
||
127 | * Get the primary arg for this event. |
||
128 | * |
||
129 | * @since 1.0.0 |
||
130 | * |
||
131 | * @return WordPoints_Entity|false The entity objects for the primary arg, or |
||
132 | * false if this entity has none. |
||
133 | */ |
||
134 | public function get_primary_arg() { |
||
142 | |||
143 | /** |
||
144 | * Set the validator for the current reaction. |
||
145 | * |
||
146 | * @since 1.0.0 |
||
147 | * |
||
148 | * @param WordPoints_Hook_Reaction_Validator $validator The validator. |
||
149 | */ |
||
150 | public function set_validator( WordPoints_Hook_Reaction_Validator $validator ) { |
||
153 | |||
154 | /** |
||
155 | * @since 1.0.0 |
||
156 | */ |
||
157 | public function descend( $child_slug ) { |
||
202 | |||
203 | /** |
||
204 | * @since 1.0.0 |
||
205 | */ |
||
206 | public function ascend() { |
||
216 | |||
217 | /** |
||
218 | * @since 1.0.0 |
||
219 | */ |
||
220 | public function get_from_hierarchy( array $hierarchy ) { |
||
228 | } |
||
229 | |||
231 |
In PHP, under loose comparison (like
==
, or!=
, orswitch
conditions), values of different types might be equal.For
string
values, the empty string''
is a special case, in particular the following results might be unexpected: