@@ -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; |
@@ -114,11 +114,11 @@ discard block |
||
| 114 | 114 | */ |
| 115 | 115 | public function get_primary_arg() { |
| 116 | 116 | |
| 117 | - if ( ! $this->primary_arg_slug ) { |
|
| 117 | + if ( ! $this->primary_arg_slug) { |
|
| 118 | 118 | return false; |
| 119 | 119 | } |
| 120 | 120 | |
| 121 | - return $this->entities[ $this->primary_arg_slug ]; |
|
| 121 | + return $this->entities[$this->primary_arg_slug]; |
|
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | /** |
@@ -132,8 +132,8 @@ discard block |
||
| 132 | 132 | |
| 133 | 133 | $stateful = $this->entities; |
| 134 | 134 | |
| 135 | - if ( $this->primary_arg_slug ) { |
|
| 136 | - unset( $stateful[ $this->primary_arg_slug ] ); |
|
| 135 | + if ($this->primary_arg_slug) { |
|
| 136 | + unset($stateful[$this->primary_arg_slug]); |
|
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | return $stateful; |
@@ -157,47 +157,47 @@ discard block |
||
| 157 | 157 | * |
| 158 | 158 | * @param WordPoints_Hook_Reaction_Validator $validator The validator. |
| 159 | 159 | */ |
| 160 | - public function set_validator( WordPoints_Hook_Reaction_Validator $validator ) { |
|
| 160 | + public function set_validator(WordPoints_Hook_Reaction_Validator $validator) { |
|
| 161 | 161 | $this->validator = $validator; |
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | /** |
| 165 | 165 | * @since 1.0.0 |
| 166 | 166 | */ |
| 167 | - public function descend( $child_slug ) { |
|
| 167 | + public function descend($child_slug) { |
|
| 168 | 168 | |
| 169 | - $result = parent::descend( $child_slug ); |
|
| 169 | + $result = parent::descend($child_slug); |
|
| 170 | 170 | |
| 171 | 171 | // Just in case no validator has been set. |
| 172 | - if ( ! $this->validator ) { |
|
| 172 | + if ( ! $this->validator) { |
|
| 173 | 173 | return $result; |
| 174 | 174 | } |
| 175 | 175 | |
| 176 | - if ( ! $result ) { |
|
| 176 | + if ( ! $result) { |
|
| 177 | 177 | |
| 178 | - if ( ! isset( $this->current ) ) { |
|
| 178 | + if ( ! isset($this->current)) { |
|
| 179 | 179 | |
| 180 | 180 | $this->validator->add_error( |
| 181 | 181 | sprintf( |
| 182 | - __( 'The %s arg is not registered for this event.', 'wordpoints' ) // TODO message |
|
| 182 | + __('The %s arg is not registered for this event.', 'wordpoints') // TODO message |
|
| 183 | 183 | , $child_slug |
| 184 | 184 | ) |
| 185 | 185 | ); |
| 186 | 186 | |
| 187 | - } elseif ( ! ( $this->current instanceof WordPoints_Entity_ParentI ) ) { |
|
| 187 | + } elseif ( ! ($this->current instanceof WordPoints_Entity_ParentI)) { |
|
| 188 | 188 | |
| 189 | 189 | $this->validator->add_error( |
| 190 | - __( 'Cannot get descendant of %s: not a parent.', 'wordpoints' ) // TODO message |
|
| 190 | + __('Cannot get descendant of %s: not a parent.', 'wordpoints') // TODO message |
|
| 191 | 191 | ); |
| 192 | 192 | |
| 193 | 193 | } else { |
| 194 | 194 | |
| 195 | - $child_arg = $this->current->get_child( $child_slug ); |
|
| 195 | + $child_arg = $this->current->get_child($child_slug); |
|
| 196 | 196 | |
| 197 | - if ( ! $child_arg ) { |
|
| 197 | + if ( ! $child_arg) { |
|
| 198 | 198 | $this->validator->add_error( |
| 199 | 199 | sprintf( |
| 200 | - __( '%s does not have a child "%s".', 'wordpoints' ) // TODO message |
|
| 200 | + __('%s does not have a child "%s".', 'wordpoints') // TODO message |
|
| 201 | 201 | , $this->current->get_slug() |
| 202 | 202 | , $child_slug |
| 203 | 203 | ) |
@@ -206,9 +206,9 @@ discard block |
||
| 206 | 206 | } |
| 207 | 207 | } |
| 208 | 208 | |
| 209 | - } elseif ( $this->push_on_descend ) { |
|
| 209 | + } elseif ($this->push_on_descend) { |
|
| 210 | 210 | |
| 211 | - $this->validator->push_field( $child_slug ); |
|
| 211 | + $this->validator->push_field($child_slug); |
|
| 212 | 212 | } |
| 213 | 213 | |
| 214 | 214 | return $result; |
@@ -221,7 +221,7 @@ discard block |
||
| 221 | 221 | |
| 222 | 222 | $ascended = parent::ascend(); |
| 223 | 223 | |
| 224 | - if ( $ascended && $this->validator ) { |
|
| 224 | + if ($ascended && $this->validator) { |
|
| 225 | 225 | $this->validator->pop_field(); |
| 226 | 226 | } |
| 227 | 227 | |
@@ -231,10 +231,10 @@ discard block |
||
| 231 | 231 | /** |
| 232 | 232 | * @since 1.0.0 |
| 233 | 233 | */ |
| 234 | - public function get_from_hierarchy( array $hierarchy ) { |
|
| 234 | + public function get_from_hierarchy(array $hierarchy) { |
|
| 235 | 235 | |
| 236 | 236 | $this->push_on_descend = false; |
| 237 | - $entityish = parent::get_from_hierarchy( $hierarchy ); |
|
| 237 | + $entityish = parent::get_from_hierarchy($hierarchy); |
|
| 238 | 238 | $this->push_on_descend = true; |
| 239 | 239 | |
| 240 | 240 | return $entityish; |