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 slugs of the stateful args. |
||
32 | * |
||
33 | * Indexed by slug, so that `isset()` can be used. |
||
34 | * |
||
35 | * @since 1.0.0 |
||
36 | * |
||
37 | * @var string[] |
||
38 | */ |
||
39 | protected $stateful_args = array(); |
||
40 | |||
41 | /** |
||
42 | * The validator associated with the current hook reaction. |
||
43 | * |
||
44 | * @since 1.0.0 |
||
45 | * |
||
46 | * @var WordPoints_Hook_Reaction_Validator |
||
47 | */ |
||
48 | protected $validator; |
||
49 | |||
50 | /** |
||
51 | * Whether to push fields onto the validator when we descend into the hierarchy. |
||
52 | * |
||
53 | * This will usually be true, however, when we are getting a value from the |
||
54 | * hierarchy, we aren't actually descending into a sub-field, but descending |
||
55 | * down the arg hierarchy stored within a field. |
||
56 | * |
||
57 | * @since 1.0.0 |
||
58 | * |
||
59 | * @var bool |
||
60 | */ |
||
61 | protected $push_on_descend = true; |
||
62 | |||
63 | /** |
||
64 | * Construct the object with the arg objects. |
||
65 | * |
||
66 | * @param WordPoints_Hook_Arg[] $args The hook args. |
||
67 | */ |
||
68 | public function __construct( array $args ) { |
||
89 | |||
90 | /** |
||
91 | * Whether the event is repeatable. |
||
92 | * |
||
93 | * An event is repeatable if none of its args have their status toggled by the |
||
94 | * event. In that case, it is possible for the event to occur with those same args |
||
95 | * multiple times in a row without being reversed in between. |
||
96 | * |
||
97 | * An arg that has its status modified is called a signature arg. One that does |
||
98 | * not is called a stateful arg. An event is repeatable if it has no signature |
||
99 | * args, only stateful ones. |
||
100 | * |
||
101 | * @since 1.0.0 |
||
102 | * |
||
103 | * @return bool Whether the event is repeatable. |
||
104 | */ |
||
105 | public function is_event_repeatable() { |
||
108 | |||
109 | /** |
||
110 | * Get the stateful args for this event. |
||
111 | * |
||
112 | * @since 1.0.0 |
||
113 | * |
||
114 | * @return WordPoints_Entity[] The entity objects for the stateful args. |
||
115 | */ |
||
116 | public function get_stateful_args() { |
||
119 | |||
120 | /** |
||
121 | * Get the non-stateful args for this event. |
||
122 | * |
||
123 | * @since 1.0.0 |
||
124 | * |
||
125 | * @return WordPoints_Entity[] The entity objects for the non-stateful args. |
||
126 | */ |
||
127 | public function get_non_stateful_args() { |
||
130 | |||
131 | /** |
||
132 | * Set the validator for the current reaction. |
||
133 | * |
||
134 | * @since 1.0.0 |
||
135 | * |
||
136 | * @param WordPoints_Hook_Reaction_Validator $validator The validator. |
||
137 | */ |
||
138 | public function set_validator( WordPoints_Hook_Reaction_Validator $validator ) { |
||
141 | |||
142 | /** |
||
143 | * @since 1.0.0 |
||
144 | */ |
||
145 | public function descend( $child_slug ) { |
||
190 | |||
191 | /** |
||
192 | * @since 1.0.0 |
||
193 | */ |
||
194 | public function ascend() { |
||
204 | |||
205 | /** |
||
206 | * @since 1.0.0 |
||
207 | */ |
||
208 | public function get_from_hierarchy( array $hierarchy ) { |
||
216 | } |
||
217 | |||
219 |