@@ -63,22 +63,22 @@ discard block |
||
63 | 63 | * |
64 | 64 | * @param WordPoints_Hook_Arg[] $args The hook args. |
65 | 65 | */ |
66 | - public function __construct( array $args ) { |
|
66 | + public function __construct(array $args) { |
|
67 | 67 | |
68 | 68 | parent::__construct(); |
69 | 69 | |
70 | - foreach ( $args as $arg ) { |
|
70 | + foreach ($args as $arg) { |
|
71 | 71 | |
72 | 72 | $entity = $arg->get_entity(); |
73 | 73 | $slug = $arg->get_slug(); |
74 | 74 | |
75 | - if ( ! $entity instanceof WordPoints_Entity ) { |
|
75 | + if ( ! $entity instanceof WordPoints_Entity) { |
|
76 | 76 | continue; |
77 | 77 | } |
78 | 78 | |
79 | - $this->entities[ $slug ] = $entity; |
|
79 | + $this->entities[$slug] = $entity; |
|
80 | 80 | |
81 | - if ( ! $arg->is_stateful() ) { |
|
81 | + if ( ! $arg->is_stateful()) { |
|
82 | 82 | // If any of the args aren't stateful the event isn't repeatable. |
83 | 83 | $this->is_repeatable = false; |
84 | 84 | $this->primary_arg_slug = $slug; |
@@ -116,8 +116,8 @@ discard block |
||
116 | 116 | |
117 | 117 | $stateful = $this->entities; |
118 | 118 | |
119 | - if ( $this->primary_arg_slug ) { |
|
120 | - unset( $stateful[ $this->primary_arg_slug ] ); |
|
119 | + if ($this->primary_arg_slug) { |
|
120 | + unset($stateful[$this->primary_arg_slug]); |
|
121 | 121 | } |
122 | 122 | |
123 | 123 | return $stateful; |
@@ -133,11 +133,11 @@ discard block |
||
133 | 133 | */ |
134 | 134 | public function get_primary_arg() { |
135 | 135 | |
136 | - if ( ! $this->primary_arg_slug ) { |
|
136 | + if ( ! $this->primary_arg_slug) { |
|
137 | 137 | return false; |
138 | 138 | } |
139 | 139 | |
140 | - return $this->entities[ $this->primary_arg_slug ]; |
|
140 | + return $this->entities[$this->primary_arg_slug]; |
|
141 | 141 | } |
142 | 142 | |
143 | 143 | /** |
@@ -147,54 +147,54 @@ discard block |
||
147 | 147 | * |
148 | 148 | * @param WordPoints_Hook_Reaction_Validator $validator The validator. |
149 | 149 | */ |
150 | - public function set_validator( WordPoints_Hook_Reaction_Validator $validator ) { |
|
150 | + public function set_validator(WordPoints_Hook_Reaction_Validator $validator) { |
|
151 | 151 | $this->validator = $validator; |
152 | 152 | } |
153 | 153 | |
154 | 154 | /** |
155 | 155 | * @since 1.0.0 |
156 | 156 | */ |
157 | - public function descend( $child_slug ) { |
|
157 | + public function descend($child_slug) { |
|
158 | 158 | |
159 | - $result = parent::descend( $child_slug ); |
|
159 | + $result = parent::descend($child_slug); |
|
160 | 160 | |
161 | 161 | // Just in case no validator has been set. |
162 | - if ( ! $this->validator ) { |
|
162 | + if ( ! $this->validator) { |
|
163 | 163 | return $result; |
164 | 164 | } |
165 | 165 | |
166 | - if ( ! $result ) { |
|
166 | + if ( ! $result) { |
|
167 | 167 | |
168 | - if ( ! isset( $this->current ) ) { |
|
168 | + if ( ! isset($this->current)) { |
|
169 | 169 | |
170 | 170 | $this->validator->add_error( |
171 | 171 | sprintf( |
172 | - __( 'The %s arg is not registered for this event.', 'wordpoints' ) // TODO message |
|
172 | + __('The %s arg is not registered for this event.', 'wordpoints') // TODO message |
|
173 | 173 | , $child_slug |
174 | 174 | ) |
175 | 175 | ); |
176 | 176 | |
177 | - } elseif ( ! ( $this->current instanceof WordPoints_Entity_ParentI ) ) { |
|
177 | + } elseif ( ! ($this->current instanceof WordPoints_Entity_ParentI)) { |
|
178 | 178 | |
179 | 179 | $this->validator->add_error( |
180 | - __( 'Cannot get descendant of %s: not a parent.', 'wordpoints' ) // TODO message |
|
180 | + __('Cannot get descendant of %s: not a parent.', 'wordpoints') // TODO message |
|
181 | 181 | ); |
182 | 182 | |
183 | 183 | } else { |
184 | 184 | |
185 | - $child_arg = $this->current->get_child( $child_slug ); |
|
185 | + $child_arg = $this->current->get_child($child_slug); |
|
186 | 186 | |
187 | - if ( ! $child_arg ) { |
|
187 | + if ( ! $child_arg) { |
|
188 | 188 | $this->validator->add_error( |
189 | - __( '%s does not have a child "%s".', 'wordpoints' ) // TODO message |
|
189 | + __('%s does not have a child "%s".', 'wordpoints') // TODO message |
|
190 | 190 | , $this->push_on_descend ? $child_slug : null |
191 | 191 | ); |
192 | 192 | } |
193 | 193 | } |
194 | 194 | |
195 | - } elseif ( $this->push_on_descend ) { |
|
195 | + } elseif ($this->push_on_descend) { |
|
196 | 196 | |
197 | - $this->validator->push_field( $child_slug ); |
|
197 | + $this->validator->push_field($child_slug); |
|
198 | 198 | } |
199 | 199 | |
200 | 200 | return $result; |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | |
208 | 208 | $ascended = parent::ascend(); |
209 | 209 | |
210 | - if ( $ascended && $this->validator ) { |
|
210 | + if ($ascended && $this->validator) { |
|
211 | 211 | $this->validator->pop_field(); |
212 | 212 | } |
213 | 213 | |
@@ -217,10 +217,10 @@ discard block |
||
217 | 217 | /** |
218 | 218 | * @since 1.0.0 |
219 | 219 | */ |
220 | - public function get_from_hierarchy( array $hierarchy ) { |
|
220 | + public function get_from_hierarchy(array $hierarchy) { |
|
221 | 221 | |
222 | 222 | $this->push_on_descend = false; |
223 | - $entityish = parent::get_from_hierarchy( $hierarchy ); |
|
223 | + $entityish = parent::get_from_hierarchy($hierarchy); |
|
224 | 224 | $this->push_on_descend = true; |
225 | 225 | |
226 | 226 | return $entityish; |