Completed
Push — master ( faeb69...3d46b5 )
by J.D.
02:57
created
src/includes/functions.php 1 patch
Spacing   +114 added lines, -114 removed lines patch added patch discarded remove patch
@@ -33,9 +33,9 @@  discard block
 block discarded – undo
33 33
  *
34 34
  * @param WordPoints_Class_Registry_Persistent $reactors The reactors registry.
35 35
  */
36
-function wordpoints_hook_reactors_init( $reactors ) {
36
+function wordpoints_hook_reactors_init($reactors) {
37 37
 
38
-	$reactors->register( 'points', 'WordPoints_Hook_Reactor_Points' );
38
+	$reactors->register('points', 'WordPoints_Hook_Reactor_Points');
39 39
 }
40 40
 
41 41
 /**
@@ -47,10 +47,10 @@  discard block
 block discarded – undo
47 47
  *
48 48
  * @param WordPoints_Class_Registry_Persistent $extensions The extension registry.
49 49
  */
50
-function wordpoints_hook_extension_init( $extensions ) {
50
+function wordpoints_hook_extension_init($extensions) {
51 51
 
52
-	$extensions->register( 'conditions', 'WordPoints_Hook_Extension_Conditions' );
53
-	$extensions->register( 'periods', 'WordPoints_Hook_Extension_Periods' );
52
+	$extensions->register('conditions', 'WordPoints_Hook_Extension_Conditions');
53
+	$extensions->register('periods', 'WordPoints_Hook_Extension_Periods');
54 54
 }
55 55
 
56 56
 /**
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
  *
63 63
  * @param WordPoints_Class_Registry_Children $conditions The conditions registry.
64 64
  */
65
-function wordpoints_hook_conditions_init( $conditions ) {
65
+function wordpoints_hook_conditions_init($conditions) {
66 66
 
67 67
 	$conditions->register(
68 68
 		'text'
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
  *
99 99
  * @param WordPoints_Hook_Actions $actions The action registry.
100 100
  */
101
-function wordpoints_hook_actions_init( $actions ) {
101
+function wordpoints_hook_actions_init($actions) {
102 102
 
103 103
 	$actions->register(
104 104
 		'comment_approve'
@@ -106,8 +106,8 @@  discard block
 block discarded – undo
106 106
 		, array(
107 107
 			'action' => 'transition_comment_status',
108 108
 			'data'   => array(
109
-				'arg_index'    => array( 'comment' => 2 ),
110
-				'requirements' => array( 0 => 'approved' ),
109
+				'arg_index'    => array('comment' => 2),
110
+				'requirements' => array(0 => 'approved'),
111 111
 			),
112 112
 		)
113 113
 	);
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
 		, array(
119 119
 			'action' => 'wp_insert_comment',
120 120
 			'data'   => array(
121
-				'arg_index' => array( 'comment' => 1 ),
121
+				'arg_index' => array('comment' => 1),
122 122
 			),
123 123
 		)
124 124
 	);
@@ -129,8 +129,8 @@  discard block
 block discarded – undo
129 129
 		, array(
130 130
 			'action' => 'transition_comment_status',
131 131
 			'data'   => array(
132
-				'arg_index' => array( 'comment' => 2 ),
133
-				'requirements' => array( 1 => 'approved' ),
132
+				'arg_index' => array('comment' => 2),
133
+				'requirements' => array(1 => 'approved'),
134 134
 			),
135 135
 		)
136 136
 	);
@@ -142,8 +142,8 @@  discard block
 block discarded – undo
142 142
 		, array(
143 143
 			'action' => 'transition_post_status',
144 144
 			'data'   => array(
145
-				'arg_index' => array( 'post' => 2 ),
146
-				'requirements' => array( 0 => 'publish' ),
145
+				'arg_index' => array('post' => 2),
146
+				'requirements' => array(0 => 'publish'),
147 147
 			),
148 148
 		)
149 149
 	);
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
 		, array(
155 155
 			'action' => 'add_attachment',
156 156
 			'data'   => array(
157
-				'arg_index' => array( 'post\attachment' => 0 ),
157
+				'arg_index' => array('post\attachment' => 0),
158 158
 			),
159 159
 		)
160 160
 	);
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 		, array(
166 166
 			'action' => 'post_delete',
167 167
 			'data'   => array(
168
-				'arg_index' => array( 'post' => 0 ),
168
+				'arg_index' => array('post' => 0),
169 169
 			),
170 170
 		)
171 171
 	);
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
 		, array(
177 177
 			'action' => 'user_register',
178 178
 			'data'   => array(
179
-				'arg_index' => array( 'user' => 0 ),
179
+				'arg_index' => array('user' => 0),
180 180
 			),
181 181
 		)
182 182
 	);
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
 		, array(
188 188
 			'action' => is_multisite() ? 'wpmu_delete_user' : 'delete_user',
189 189
 			'data'   => array(
190
-				'arg_index' => array( 'user' => 0 ),
190
+				'arg_index' => array('user' => 0),
191 191
 			),
192 192
 		)
193 193
 	);
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
  *
211 211
  * @param WordPoints_Hook_Events $events The event registry.
212 212
  */
213
-function wordpoints_hook_events_init( $events ) {
213
+function wordpoints_hook_events_init($events) {
214 214
 
215 215
 	$events->register(
216 216
 		'user_register'
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 	);
241 241
 
242 242
 	// Register events for all of the public post types.
243
-	$post_types = get_post_types( array( 'public' => true ) );
243
+	$post_types = get_post_types(array('public' => true));
244 244
 
245 245
 	/**
246 246
 	 * Filter which post types to register hook events for.
@@ -249,20 +249,20 @@  discard block
 block discarded – undo
249 249
 	 *
250 250
 	 * @param string[] The post type slugs ("names").
251 251
 	 */
252
-	$post_types = apply_filters( 'wordpoints_register_hook_events_for_post_types', $post_types );
252
+	$post_types = apply_filters('wordpoints_register_hook_events_for_post_types', $post_types);
253 253
 
254
-	foreach ( $post_types as $slug ) {
255
-		wordpoints_register_post_type_hook_events( $slug );
254
+	foreach ($post_types as $slug) {
255
+		wordpoints_register_post_type_hook_events($slug);
256 256
 	}
257 257
 
258
-	if ( is_multisite() ) {
258
+	if (is_multisite()) {
259 259
 
260 260
 		$event_slugs = array(
261 261
 			'user_visit',
262 262
 			'user_register',
263 263
 		);
264 264
 
265
-		foreach ( $event_slugs as $event_slug ) {
265
+		foreach ($event_slugs as $event_slug) {
266 266
 			// TODO network hooks
267 267
 			$events->args->register(
268 268
 				$event_slug
@@ -282,11 +282,11 @@  discard block
 block discarded – undo
282 282
  *
283 283
  * @param WordPoints_Class_Registry_Persistent $firers The firer registry.
284 284
  */
285
-function wordpoints_hook_firers_init( $firers ) {
285
+function wordpoints_hook_firers_init($firers) {
286 286
 
287
-	$firers->register( 'fire', 'WordPoints_Hook_Firer' );
288
-	$firers->register( 'reverse', 'WordPoints_Hook_Firer_Reverse' );
289
-	$firers->register( 'spam', 'WordPoints_Hook_Firer_Spam' );
287
+	$firers->register('fire', 'WordPoints_Hook_Firer');
288
+	$firers->register('reverse', 'WordPoints_Hook_Firer_Reverse');
289
+	$firers->register('spam', 'WordPoints_Hook_Firer_Spam');
290 290
 }
291 291
 
292 292
 /**
@@ -298,10 +298,10 @@  discard block
 block discarded – undo
298 298
  *
299 299
  * @param WordPoints_App_Registry $entities The entities app.
300 300
  */
301
-function wordpoints_entities_app_init( $entities ) {
301
+function wordpoints_entities_app_init($entities) {
302 302
 
303
-	$entities->sub_apps->register( 'children', 'WordPoints_Class_Registry_Children' );
304
-	$entities->sub_apps->register( 'contexts', 'WordPoints_Class_Registry' );
303
+	$entities->sub_apps->register('children', 'WordPoints_Class_Registry_Children');
304
+	$entities->sub_apps->register('contexts', 'WordPoints_Class_Registry');
305 305
 }
306 306
 
307 307
 /**
@@ -313,10 +313,10 @@  discard block
 block discarded – undo
313 313
  *
314 314
  * @param WordPoints_Class_Registry $contexts The entity context registry.
315 315
  */
316
-function wordpoints_entity_contexts_init( $contexts ) {
316
+function wordpoints_entity_contexts_init($contexts) {
317 317
 
318
-	$contexts->register( 'network', 'WordPoints_Entity_Context_Network' );
319
-	$contexts->register( 'site', 'WordPoints_Entity_Context_Site' );
318
+	$contexts->register('network', 'WordPoints_Entity_Context_Network');
319
+	$contexts->register('site', 'WordPoints_Entity_Context_Site');
320 320
 }
321 321
 
322 322
 /**
@@ -328,18 +328,18 @@  discard block
 block discarded – undo
328 328
  *
329 329
  * @param WordPoints_App_Registry $entities The entities app.
330 330
  */
331
-function wordpoints_entities_init( $entities ) {
331
+function wordpoints_entities_init($entities) {
332 332
 
333 333
 	$children = $entities->children;
334 334
 
335
-	$entities->register( 'user', 'WordPoints_Entity_User' );
336
-	$children->register( 'user', 'roles', 'WordPoints_Entity_User_Roles' );
335
+	$entities->register('user', 'WordPoints_Entity_User');
336
+	$children->register('user', 'roles', 'WordPoints_Entity_User_Roles');
337 337
 
338
-	$entities->register( 'user_role', 'WordPoints_Entity_User_Role' );
339
-	$children->register( 'user_role', 'name', 'WordPoints_Entity_User_Role_Name' );
338
+	$entities->register('user_role', 'WordPoints_Entity_User_Role');
339
+	$children->register('user_role', 'name', 'WordPoints_Entity_User_Role_Name');
340 340
 
341 341
 	// Register entities for all of the public post types.
342
-	$post_types = get_post_types( array( 'public' => true ) );
342
+	$post_types = get_post_types(array('public' => true));
343 343
 
344 344
 	/**
345 345
 	 * Filter which post types to register entities for.
@@ -348,14 +348,14 @@  discard block
 block discarded – undo
348 348
 	 *
349 349
 	 * @param string[] The post type slugs ("names").
350 350
 	 */
351
-	$post_types = apply_filters( 'wordpoints_register_entities_for_post_types', $post_types );
351
+	$post_types = apply_filters('wordpoints_register_entities_for_post_types', $post_types);
352 352
 
353
-	foreach ( $post_types as $slug ) {
354
-		wordpoints_register_post_type_entities( $slug );
353
+	foreach ($post_types as $slug) {
354
+		wordpoints_register_post_type_entities($slug);
355 355
 	}
356 356
 
357 357
 	// Register entities for all of the public taxonomies.
358
-	$taxonomies = get_taxonomies( array( 'public' => true ) );
358
+	$taxonomies = get_taxonomies(array('public' => true));
359 359
 
360 360
 	/**
361 361
 	 * Filter which taxonomies to register entities for.
@@ -364,10 +364,10 @@  discard block
 block discarded – undo
364 364
 	 *
365 365
 	 * @param string[] The taxonomy slugs.
366 366
 	 */
367
-	$taxonomies = apply_filters( 'wordpoints_register_entities_for_taxonomies', $taxonomies );
367
+	$taxonomies = apply_filters('wordpoints_register_entities_for_taxonomies', $taxonomies);
368 368
 
369
-	foreach ( $taxonomies as $slug ) {
370
-		wordpoints_register_taxonomy_entities( $slug );
369
+	foreach ($taxonomies as $slug) {
370
+		wordpoints_register_taxonomy_entities($slug);
371 371
 	}
372 372
 }
373 373
 
@@ -378,28 +378,28 @@  discard block
 block discarded – undo
378 378
  *
379 379
  * @param string $slug The slug of the post type.
380 380
  */
381
-function wordpoints_register_post_type_entities( $slug ) {
381
+function wordpoints_register_post_type_entities($slug) {
382 382
 
383 383
 	$entities = wordpoints_entities();
384 384
 	$children = $entities->children;
385 385
 
386
-	$entities->register( "post\\{$slug}", 'WordPoints_Entity_Post' );
387
-	$children->register( "post\\{$slug}", 'author', 'WordPoints_Entity_Post_Author' );
386
+	$entities->register("post\\{$slug}", 'WordPoints_Entity_Post');
387
+	$children->register("post\\{$slug}", 'author', 'WordPoints_Entity_Post_Author');
388 388
 
389
-	$supports = get_all_post_type_supports( $slug );
389
+	$supports = get_all_post_type_supports($slug);
390 390
 
391
-	if ( isset( $supports['editor'] ) ) {
392
-		$children->register( "post\\{$slug}", 'content', 'WordPoints_Entity_Post_Content' );
391
+	if (isset($supports['editor'])) {
392
+		$children->register("post\\{$slug}", 'content', 'WordPoints_Entity_Post_Content');
393 393
 	}
394 394
 
395
-	if ( isset( $supports['comments'] ) ) {
396
-		$entities->register( "comment\\{$slug}", 'WordPoints_Entity_Comment' );
397
-		$children->register( "comment\\{$slug}", "post\\{$slug}", 'WordPoints_Entity_Comment_Post' );
398
-		$children->register( "comment\\{$slug}", 'author', 'WordPoints_Entity_Comment_Author' );
395
+	if (isset($supports['comments'])) {
396
+		$entities->register("comment\\{$slug}", 'WordPoints_Entity_Comment');
397
+		$children->register("comment\\{$slug}", "post\\{$slug}", 'WordPoints_Entity_Comment_Post');
398
+		$children->register("comment\\{$slug}", 'author', 'WordPoints_Entity_Comment_Author');
399 399
 	}
400 400
 
401
-	foreach ( get_object_taxonomies( $slug ) as $taxonomy_slug ) {
402
-		$children->register( "post\\{$slug}", "terms\\{$taxonomy_slug}", 'WordPoints_Entity_Post_Terms' );
401
+	foreach (get_object_taxonomies($slug) as $taxonomy_slug) {
402
+		$children->register("post\\{$slug}", "terms\\{$taxonomy_slug}", 'WordPoints_Entity_Post_Terms');
403 403
 	}
404 404
 
405 405
 	/**
@@ -409,7 +409,7 @@  discard block
 block discarded – undo
409 409
 	 *
410 410
 	 * @param string $slug The slug ("name") of the post type.
411 411
 	 */
412
-	do_action( 'wordpoints_register_post_type_entities', $slug );
412
+	do_action('wordpoints_register_post_type_entities', $slug);
413 413
 }
414 414
 
415 415
 /**
@@ -419,13 +419,13 @@  discard block
 block discarded – undo
419 419
  *
420 420
  * @param string $slug The slug of the post type.
421 421
  */
422
-function wordpoints_register_post_type_hook_events( $slug ) {
422
+function wordpoints_register_post_type_hook_events($slug) {
423 423
 
424 424
 	$event_slugs = array();
425 425
 
426 426
 	$events = wordpoints_hooks()->events;
427 427
 
428
-	if ( 'attachment' === $slug ) {
428
+	if ('attachment' === $slug) {
429 429
 
430 430
 		$event_slugs[] = 'media_upload';
431 431
 
@@ -462,7 +462,7 @@  discard block
 block discarded – undo
462 462
 		);
463 463
 	}
464 464
 
465
-	if ( post_type_supports( $slug, 'comments' ) ) {
465
+	if (post_type_supports($slug, 'comments')) {
466 466
 
467 467
 		$event_slugs[] = "comment_leave\\{$slug}";
468 468
 
@@ -471,7 +471,7 @@  discard block
 block discarded – undo
471 471
 			, 'WordPoints_Hook_Event_Comment_Leave'
472 472
 			, array(
473 473
 				'actions' => array(
474
-					'fire' => array( 'comment_approve', 'comment_new' ),
474
+					'fire' => array('comment_approve', 'comment_new'),
475 475
 					'reverse' => 'comment_deapprove',
476 476
 					'spam' => 'comment_spam',
477 477
 				),
@@ -482,8 +482,8 @@  discard block
 block discarded – undo
482 482
 		);
483 483
 	}
484 484
 
485
-	if ( is_multisite() ) {
486
-		foreach ( $event_slugs as $event_slug ) {
485
+	if (is_multisite()) {
486
+		foreach ($event_slugs as $event_slug) {
487 487
 			$events->args->register(
488 488
 				$event_slug
489 489
 				, 'current:site'
@@ -499,7 +499,7 @@  discard block
 block discarded – undo
499 499
 	 *
500 500
 	 * @param string $slug The slug ("name") of the post type.
501 501
 	 */
502
-	do_action( 'wordpoints_register_post_type_hook_events', $slug );
502
+	do_action('wordpoints_register_post_type_hook_events', $slug);
503 503
 }
504 504
 
505 505
 /**
@@ -509,13 +509,13 @@  discard block
 block discarded – undo
509 509
  *
510 510
  * @param string $slug The slug of the taxonomy.
511 511
  */
512
-function wordpoints_register_taxonomy_entities( $slug ) {
512
+function wordpoints_register_taxonomy_entities($slug) {
513 513
 
514 514
 	$entities = wordpoints_entities();
515 515
 	$children = $entities->children;
516 516
 
517
-	$entities->register( "term\\{$slug}", 'WordPoints_Entity_Term' );
518
-	$children->register( "term\\{$slug}", 'id', 'WordPoints_Entity_Term_Id' );
517
+	$entities->register("term\\{$slug}", 'WordPoints_Entity_Term');
518
+	$children->register("term\\{$slug}", 'id', 'WordPoints_Entity_Term_Id');
519 519
 
520 520
 	/**
521 521
 	 * Fired when registering the entities for a taxonomy.
@@ -524,7 +524,7 @@  discard block
 block discarded – undo
524 524
 	 *
525 525
 	 * @param string $slug The taxonomy's slug.
526 526
 	 */
527
-	do_action( 'wordpoints_register_taxonomy_entities', $slug );
527
+	do_action('wordpoints_register_taxonomy_entities', $slug);
528 528
 }
529 529
 
530 530
 /**
@@ -536,10 +536,10 @@  discard block
 block discarded – undo
536 536
  *
537 537
  * @param WordPoints_Class_RegistryI $data_types The data types registry.
538 538
  */
539
-function wordpoints_data_types_init( $data_types ) {
539
+function wordpoints_data_types_init($data_types) {
540 540
 
541
-	$data_types->register( 'integer', 'WordPoints_Data_Type_Integer' );
542
-	$data_types->register( 'text', 'WordPoints_Data_Type_Text' );
541
+	$data_types->register('integer', 'WordPoints_Data_Type_Integer');
542
+	$data_types->register('text', 'WordPoints_Data_Type_Text');
543 543
 }
544 544
 
545 545
 /**
@@ -554,9 +554,9 @@  discard block
 block discarded – undo
554 554
  *
555 555
  * @return bool Whether the user can view the points log.
556 556
  */
557
-function wordpoints_hooks_user_can_view_points_log( $can_view, $log ) {
557
+function wordpoints_hooks_user_can_view_points_log($can_view, $log) {
558 558
 
559
-	if ( ! $can_view ) {
559
+	if ( ! $can_view) {
560 560
 		return $can_view;
561 561
 	}
562 562
 
@@ -565,11 +565,11 @@  discard block
 block discarded – undo
565 565
 	$event_slug = $log->log_type;
566 566
 
567 567
 	/** @var WordPoints_Hook_Arg $arg */
568
-	foreach ( wordpoints_hooks()->events->args->get_children( $event_slug ) as $slug => $arg ) {
568
+	foreach (wordpoints_hooks()->events->args->get_children($event_slug) as $slug => $arg) {
569 569
 
570
-		$value = wordpoints_get_points_log_meta( $log->id, $slug, true );
570
+		$value = wordpoints_get_points_log_meta($log->id, $slug, true);
571 571
 
572
-		if ( ! $value ) {
572
+		if ( ! $value) {
573 573
 			continue;
574 574
 		}
575 575
 
@@ -579,7 +579,7 @@  discard block
 block discarded – undo
579 579
 			, $value
580 580
 		);
581 581
 
582
-		if ( ! $can_view ) {
582
+		if ( ! $can_view) {
583 583
 			break;
584 584
 		}
585 585
 	}
@@ -598,20 +598,20 @@  discard block
 block discarded – undo
598 598
  *
599 599
  * @return bool Whether the user can view this entity.
600 600
  */
601
-function wordpoints_entity_user_can_view( $user_id, $entity_slug, $entity_id ) {
601
+function wordpoints_entity_user_can_view($user_id, $entity_slug, $entity_id) {
602 602
 
603
-	$entity = wordpoints_entities()->get( $entity_slug );
603
+	$entity = wordpoints_entities()->get($entity_slug);
604 604
 
605 605
 	// If this entity type is not found, we have no way of determining whether it is
606 606
 	// safe for the user to view it.
607
-	if ( ! ( $entity instanceof WordPoints_Entity ) ) {
607
+	if ( ! ($entity instanceof WordPoints_Entity)) {
608 608
 		return false;
609 609
 	}
610 610
 
611 611
 	$can_view = true;
612 612
 
613
-	if ( $entity instanceof WordPoints_Entity_Restricted_VisibilityI ) {
614
-		$can_view = $entity->user_can_view( $user_id, $entity_id );
613
+	if ($entity instanceof WordPoints_Entity_Restricted_VisibilityI) {
614
+		$can_view = $entity->user_can_view($user_id, $entity_id);
615 615
 	}
616 616
 
617 617
 	/**
@@ -642,8 +642,8 @@  discard block
 block discarded – undo
642 642
  */
643 643
 function wordpoints_apps() {
644 644
 
645
-	if ( ! isset( WordPoints_App::$main ) ) {
646
-		WordPoints_App::$main = new WordPoints_App( 'apps' );
645
+	if ( ! isset(WordPoints_App::$main)) {
646
+		WordPoints_App::$main = new WordPoints_App('apps');
647 647
 	}
648 648
 
649 649
 	return WordPoints_App::$main;
@@ -658,7 +658,7 @@  discard block
 block discarded – undo
658 658
  */
659 659
 function wordpoints_hooks() {
660 660
 
661
-	if ( ! isset( WordPoints_App::$main ) ) {
661
+	if ( ! isset(WordPoints_App::$main)) {
662 662
 		wordpoints_apps();
663 663
 	}
664 664
 
@@ -674,7 +674,7 @@  discard block
 block discarded – undo
674 674
  */
675 675
 function wordpoints_entities() {
676 676
 
677
-	if ( ! isset( WordPoints_App::$main ) ) {
677
+	if ( ! isset(WordPoints_App::$main)) {
678 678
 		wordpoints_apps();
679 679
 	}
680 680
 
@@ -690,13 +690,13 @@  discard block
 block discarded – undo
690 690
  *
691 691
  * @param WordPoints_App $app The main apps app.
692 692
  */
693
-function wordpoints_apps_init( $app ) {
693
+function wordpoints_apps_init($app) {
694 694
 
695 695
 	$apps = $app->sub_apps;
696 696
 
697
-	$apps->register( 'hooks', 'WordPoints_Hooks' );
698
-	$apps->register( 'entities', 'WordPoints_App_Registry' );
699
-	$apps->register( 'data_types', 'WordPoints_Class_Registry' );
697
+	$apps->register('hooks', 'WordPoints_Hooks');
698
+	$apps->register('entities', 'WordPoints_App_Registry');
699
+	$apps->register('data_types', 'WordPoints_Class_Registry');
700 700
 }
701 701
 
702 702
 /**
@@ -709,19 +709,19 @@  discard block
 block discarded – undo
709 709
  *
710 710
  * @return object|false The constructed object, or false if to many args were passed.
711 711
  */
712
-function wordpoints_construct_class_with_args( $class_name, array $args ) {
712
+function wordpoints_construct_class_with_args($class_name, array $args) {
713 713
 
714
-	switch ( count( $args ) ) {
714
+	switch (count($args)) {
715 715
 		case 0:
716 716
 			return new $class_name();
717 717
 		case 1:
718
-			return new $class_name( $args[0] );
718
+			return new $class_name($args[0]);
719 719
 		case 2:
720
-			return new $class_name( $args[0], $args[1] );
720
+			return new $class_name($args[0], $args[1]);
721 721
 		case 3:
722
-			return new $class_name( $args[0], $args[1], $args[2] );
722
+			return new $class_name($args[0], $args[1], $args[2]);
723 723
 		case 4:
724
-			return new $class_name( $args[0], $args[1], $args[2], $args[3] );
724
+			return new $class_name($args[0], $args[1], $args[2], $args[3]);
725 725
 		default:
726 726
 			return false;
727 727
 	}
@@ -743,13 +743,13 @@  discard block
 block discarded – undo
743 743
  * @return array The slug parsed into the 'generic' and 'dynamic' portions. If the
744 744
  *               slug is not dynamic, the value of each of those keys will be false.
745 745
  */
746
-function wordpoints_parse_dynamic_slug( $slug ) {
746
+function wordpoints_parse_dynamic_slug($slug) {
747 747
 
748
-	$parsed = array( 'dynamic' => false, 'generic' => false );
748
+	$parsed = array('dynamic' => false, 'generic' => false);
749 749
 
750
-	$parts = explode( '\\', $slug, 2 );
750
+	$parts = explode('\\', $slug, 2);
751 751
 
752
-	if ( isset( $parts[1] ) ) {
752
+	if (isset($parts[1])) {
753 753
 		$parsed['dynamic'] = $parts[1];
754 754
 		$parsed['generic'] = $parts[0];
755 755
 	}
@@ -786,43 +786,43 @@  discard block
 block discarded – undo
786 786
  * @return array|false The IDs of the context(s) you passed in, indexed by context
787 787
  *                     slug, or false if any of the contexts isn't current.
788 788
  */
789
-function wordpoints_entities_get_current_context_id( array $slugs ) {
789
+function wordpoints_entities_get_current_context_id(array $slugs) {
790 790
 
791 791
 	$current_context = array();
792 792
 
793 793
 	/** @var WordPoints_Class_Registry $contexts */
794 794
 	$contexts = wordpoints_entities()->contexts;
795 795
 
796
-	foreach ( $slugs as $slug ) {
796
+	foreach ($slugs as $slug) {
797 797
 
798
-		$context = $contexts->get( $slug );
798
+		$context = $contexts->get($slug);
799 799
 
800
-		if ( ! $context instanceof WordPoints_Entity_Context ) {
800
+		if ( ! $context instanceof WordPoints_Entity_Context) {
801 801
 			return false;
802 802
 		}
803 803
 
804 804
 		$id = $context->get_current_id();
805 805
 
806
-		if ( false === $id ) {
806
+		if (false === $id) {
807 807
 			return false;
808 808
 		}
809 809
 
810
-		$current_context[ $slug ] = $id;
810
+		$current_context[$slug] = $id;
811 811
 	}
812 812
 
813 813
 	return $current_context;
814 814
 }
815 815
 
816
-function wordpoints_hooks_get_event_signature( WordPoints_Hook_Event_Args $event_args ) {
816
+function wordpoints_hooks_get_event_signature(WordPoints_Hook_Event_Args $event_args) {
817 817
 
818 818
 	$entity = $event_args->get_primary_arg();
819 819
 
820 820
 	// TODO what if GUID isn't set?
821
-	if ( ! $entity ) {
822
-		return str_repeat( '-', 64 );
821
+	if ( ! $entity) {
822
+		return str_repeat('-', 64);
823 823
 	}
824 824
 
825
-	return wordpoints_hash( wp_json_encode( $entity->get_the_guid() ) );
825
+	return wordpoints_hash(wp_json_encode($entity->get_the_guid()));
826 826
 }
827 827
 
828 828
 // EOF
Please login to merge, or discard this patch.
src/includes/classes/hook/reactor.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -97,29 +97,29 @@  discard block
 block discarded – undo
97 97
 	/**
98 98
 	 * @since 1.0.0
99 99
 	 */
100
-	public function __get( $var ) {
100
+	public function __get($var) {
101 101
 
102 102
 		$network_mode = wordpoints_hooks()->get_network_mode();
103 103
 
104
-		switch ( $var ) {
104
+		switch ($var) {
105 105
 			case 'reactions':
106 106
 				$var = $network_mode ? 'network_reactions' : 'standard_reactions';
107 107
 				// fall through
108 108
 
109 109
 			case 'standard_reactions':
110 110
 			case 'network_reactions':
111
-				if ( $network_mode && 'standard_reactions' === $var ) {
111
+				if ($network_mode && 'standard_reactions' === $var) {
112 112
 					return null;
113 113
 				}
114 114
 
115
-				if ( 'network_reactions' === $var && ! $this->is_network_wide() ) {
115
+				if ('network_reactions' === $var && ! $this->is_network_wide()) {
116 116
 					return null;
117 117
 				}
118 118
 
119
-				if ( ! isset( $this->$var ) ) {
120
-					if ( isset( $this->{"{$var}_class"} ) ) {
119
+				if ( ! isset($this->$var)) {
120
+					if (isset($this->{"{$var}_class"} )) {
121 121
 						$this->$var = new $this->{"{$var}_class"}(
122
-							substr( $var, 0, -10 /* _reactions */ )
122
+							substr($var, 0, -10 /* _reactions */)
123 123
 							, $this
124 124
 						);
125 125
 					}
@@ -194,21 +194,21 @@  discard block
 block discarded – undo
194 194
 	 *
195 195
 	 * @return WordPoints_Hook_ReactionI[] All of the reaction objects.
196 196
 	 */
197
-	public function get_all_reactions_to_event( $event_slug ) {
197
+	public function get_all_reactions_to_event($event_slug) {
198 198
 
199 199
 		$reactions = array();
200 200
 
201
-		foreach ( array( 'standard', 'network' ) as $store ) {
201
+		foreach (array('standard', 'network') as $store) {
202 202
 
203 203
 			$storage = $this->{"{$store}_reactions"};
204 204
 
205
-			if ( ! $storage instanceof WordPoints_Hook_Reaction_StorageI ) {
205
+			if ( ! $storage instanceof WordPoints_Hook_Reaction_StorageI) {
206 206
 				continue;
207 207
 			}
208 208
 
209 209
 			$reactions = array_merge(
210 210
 				$reactions
211
-				, $storage->get_reactions_to_event( $event_slug )
211
+				, $storage->get_reactions_to_event($event_slug)
212 212
 			);
213 213
 		}
214 214
 
@@ -230,15 +230,15 @@  discard block
 block discarded – undo
230 230
 
231 231
 		$reactions = array();
232 232
 
233
-		foreach ( array( 'standard', 'network' ) as $store ) {
233
+		foreach (array('standard', 'network') as $store) {
234 234
 
235 235
 			$storage = $this->{"{$store}_reactions"};
236 236
 
237
-			if ( ! $storage instanceof WordPoints_Hook_Reaction_StorageI ) {
237
+			if ( ! $storage instanceof WordPoints_Hook_Reaction_StorageI) {
238 238
 				continue;
239 239
 			}
240 240
 
241
-			$reactions = array_merge( $reactions, $storage->get_reactions() );
241
+			$reactions = array_merge($reactions, $storage->get_reactions());
242 242
 		}
243 243
 
244 244
 		return $reactions;
@@ -254,21 +254,21 @@  discard block
 block discarded – undo
254 254
 	) {
255 255
 
256 256
 		if (
257
-			empty( $settings['target'] )
258
-			|| ! is_array( $settings['target'] )
257
+			empty($settings['target'])
258
+			|| ! is_array($settings['target'])
259 259
 		) {
260 260
 
261
-			$validator->add_error( __( 'Invalid target.', 'wordpoints' ), 'target' );
261
+			$validator->add_error(__('Invalid target.', 'wordpoints'), 'target');
262 262
 
263 263
 		} else {
264 264
 
265
-			$target = $event_args->get_from_hierarchy( $settings['target'] );
265
+			$target = $event_args->get_from_hierarchy($settings['target']);
266 266
 
267 267
 			if (
268 268
 				! $target instanceof WordPoints_Entity
269
-				|| ! in_array( $target->get_slug(), (array) $this->arg_types )
269
+				|| ! in_array($target->get_slug(), (array) $this->arg_types)
270 270
 			) {
271
-				$validator->add_error( __( 'Invalid target.', 'wordpoints' ), 'target' );
271
+				$validator->add_error(__('Invalid target.', 'wordpoints'), 'target');
272 272
 			}
273 273
 		}
274 274
 
@@ -278,8 +278,8 @@  discard block
 block discarded – undo
278 278
 	/**
279 279
 	 * @since 1.0.0
280 280
 	 */
281
-	public function update_settings( WordPoints_Hook_ReactionI $reaction, array $settings ) {
282
-		$reaction->update_meta( 'target', $settings['target'] );
281
+	public function update_settings(WordPoints_Hook_ReactionI $reaction, array $settings) {
282
+		$reaction->update_meta('target', $settings['target']);
283 283
 	}
284 284
 
285 285
 	/**
Please login to merge, or discard this patch.
src/includes/classes/hook/reaction.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -35,18 +35,18 @@
 block discarded – undo
35 35
 	/**
36 36
 	 * @since 1.0.0
37 37
 	 */
38
-	public function __construct( $id, WordPoints_Hook_Reaction_StorageI $storage ) {
38
+	public function __construct($id, WordPoints_Hook_Reaction_StorageI $storage) {
39 39
 
40
-		$this->ID      = wordpoints_int( $id );
40
+		$this->ID      = wordpoints_int($id);
41 41
 		$this->storage = $storage;
42 42
 	}
43 43
 
44 44
 	/**
45 45
 	 * @since 1.0.0
46 46
 	 */
47
-	public function __get( $var ) {
47
+	public function __get($var) {
48 48
 
49
-		if ( 'ID' === $var ) {
49
+		if ('ID' === $var) {
50 50
 			return $this->ID;
51 51
 		}
52 52
 
Please login to merge, or discard this patch.
src/includes/classes/hook/reaction/storage/options/network.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
 	/**
18 18
 	 * @since 1.0.0
19 19
 	 */
20
-	protected $context = array( 'network' );
20
+	protected $context = array('network');
21 21
 
22 22
 	/**
23 23
 	 * @since 1.0.0
@@ -27,29 +27,29 @@  discard block
 block discarded – undo
27 27
 	/**
28 28
 	 * @since 1.0.0
29 29
 	 */
30
-	public function get_option( $name ) {
31
-		return get_site_option( $name );
30
+	public function get_option($name) {
31
+		return get_site_option($name);
32 32
 	}
33 33
 
34 34
 	/**
35 35
 	 * @since 1.0.0
36 36
 	 */
37
-	protected function add_option( $name, $value ) {
38
-		return add_site_option( $name, $value );
37
+	protected function add_option($name, $value) {
38
+		return add_site_option($name, $value);
39 39
 	}
40 40
 
41 41
 	/**
42 42
 	 * @since 1.0.0
43 43
 	 */
44
-	public function update_option( $name, $value ) {
45
-		return update_site_option( $name, $value );
44
+	public function update_option($name, $value) {
45
+		return update_site_option($name, $value);
46 46
 	}
47 47
 
48 48
 	/**
49 49
 	 * @since 1.0.0
50 50
 	 */
51
-	protected function delete_option( $name ) {
52
-		return delete_site_option( $name );
51
+	protected function delete_option($name) {
52
+		return delete_site_option($name);
53 53
 	}
54 54
 }
55 55
 
Please login to merge, or discard this patch.
src/includes/classes/hook/reaction/storage.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 	 *
45 45
 	 * @var string[]
46 46
 	 */
47
-	protected $context = array( 'network', 'site' );
47
+	protected $context = array('network', 'site');
48 48
 
49 49
 	/**
50 50
 	 * The name of the class to use for reaction objects.
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 	/**
61 61
 	 * @since 1.0.0
62 62
 	 */
63
-	public function __construct( $slug, WordPoints_Hook_Reactor $reactor ) {
63
+	public function __construct($slug, WordPoints_Hook_Reactor $reactor) {
64 64
 
65 65
 		$this->slug = $slug;
66 66
 		$this->reactor = $reactor;
@@ -84,33 +84,33 @@  discard block
 block discarded – undo
84 84
 	 * @since 1.0.0
85 85
 	 */
86 86
 	public function get_context_id() {
87
-		return wordpoints_entities_get_current_context_id( $this->context );
87
+		return wordpoints_entities_get_current_context_id($this->context);
88 88
 	}
89 89
 
90 90
 	/**
91 91
 	 * @since 1.0.0
92 92
 	 */
93
-	public function get_reaction( $id ) {
93
+	public function get_reaction($id) {
94 94
 
95
-		if ( ! $this->reaction_exists( $id ) ) {
95
+		if ( ! $this->reaction_exists($id)) {
96 96
 			return false;
97 97
 		}
98 98
 
99
-		return new $this->reaction_class( $id, $this );
99
+		return new $this->reaction_class($id, $this);
100 100
 	}
101 101
 
102 102
 	/**
103 103
 	 * @since 1.0.0
104 104
 	 */
105
-	public function create_reaction( array $settings ) {
106
-		return $this->create_or_update_reaction( $settings );
105
+	public function create_reaction(array $settings) {
106
+		return $this->create_or_update_reaction($settings);
107 107
 	}
108 108
 
109 109
 	/**
110 110
 	 * @since 1.0.0
111 111
 	 */
112
-	public function update_reaction( $id, array $settings ) {
113
-		return $this->create_or_update_reaction( $settings, $id );
112
+	public function update_reaction($id, array $settings) {
113
+		return $this->create_or_update_reaction($settings, $id);
114 114
 	}
115 115
 
116 116
 	/**
@@ -125,41 +125,41 @@  discard block
 block discarded – undo
125 125
 	 *         The reaction object if created/updated successfully. False or a
126 126
 	 *         validator instance if not.
127 127
 	 */
128
-	protected function create_or_update_reaction( array $settings, $id = null ) {
128
+	protected function create_or_update_reaction(array $settings, $id = null) {
129 129
 
130
-		$is_new = ! isset( $id );
130
+		$is_new = ! isset($id);
131 131
 
132
-		if ( ! $is_new && ! $this->reaction_exists( $id ) ) {
132
+		if ( ! $is_new && ! $this->reaction_exists($id)) {
133 133
 			return false;
134 134
 		}
135 135
 
136
-		$validator = new WordPoints_Hook_Reaction_Validator( $settings, $this->reactor );
136
+		$validator = new WordPoints_Hook_Reaction_Validator($settings, $this->reactor);
137 137
 		$settings = $validator->validate();
138 138
 
139
-		if ( $validator->had_errors() ) {
139
+		if ($validator->had_errors()) {
140 140
 			return $validator;
141 141
 		}
142 142
 
143
-		if ( $is_new ) {
143
+		if ($is_new) {
144 144
 
145
-			$id = $this->_create_reaction( $settings['event'] );
145
+			$id = $this->_create_reaction($settings['event']);
146 146
 
147
-			if ( ! $id ) {
147
+			if ( ! $id) {
148 148
 				return false;
149 149
 			}
150 150
 		}
151 151
 
152
-		$reaction = $this->get_reaction( $id );
152
+		$reaction = $this->get_reaction($id);
153 153
 
154
-		$reaction->update_event_slug( $settings['event'] );
154
+		$reaction->update_event_slug($settings['event']);
155 155
 
156
-		unset( $settings['event'] );
156
+		unset($settings['event']);
157 157
 
158
-		$this->reactor->update_settings( $reaction, $settings );
158
+		$this->reactor->update_settings($reaction, $settings);
159 159
 
160 160
 		/** @var WordPoints_Hook_Extension $extension */
161
-		foreach ( wordpoints_hooks()->extensions->get_all() as $extension ) {
162
-			$extension->update_settings( $reaction, $settings );
161
+		foreach (wordpoints_hooks()->extensions->get_all() as $extension) {
162
+			$extension->update_settings($reaction, $settings);
163 163
 		}
164 164
 
165 165
 		/**
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
 		 * @param array                     $settings The new settings for the reaction.
170 170
 		 * @param bool                      $is_new   Whether the reaction was just now created.
171 171
 		 */
172
-		do_action( 'wordpoints_hook_reaction_save', $reaction, $settings, $is_new );
172
+		do_action('wordpoints_hook_reaction_save', $reaction, $settings, $is_new);
173 173
 
174 174
 		return $reaction;
175 175
 	}
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
 	 *
187 187
 	 * @return int|false The reaction ID, or false if not created.
188 188
 	 */
189
-	abstract protected function _create_reaction( $event_slug );
189
+	abstract protected function _create_reaction($event_slug);
190 190
 }
191 191
 
192 192
 // EOF
Please login to merge, or discard this patch.
src/includes/classes/hook/reaction/storagei.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 	 * @param string                  $slug    The slug of this storage group.
26 26
 	 * @param WordPoints_Hook_Reactor $reactor The reactor the reactions belong to.
27 27
 	 */
28
-	public function __construct( $slug, WordPoints_Hook_Reactor $reactor );
28
+	public function __construct($slug, WordPoints_Hook_Reactor $reactor);
29 29
 
30 30
 	/**
31 31
 	 * Get the slug of this reaction storage group.
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 	 *
70 70
 	 * @return bool Whether the reaction exists.
71 71
 	 */
72
-	public function reaction_exists( $id );
72
+	public function reaction_exists($id);
73 73
 
74 74
 	/**
75 75
 	 * Get an reaction object.
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 	 *
81 81
 	 * @return WordPoints_Hook_ReactionI|false The reaction, or false if nonexistent.
82 82
 	 */
83
-	public function get_reaction( $id );
83
+	public function get_reaction($id);
84 84
 
85 85
 	/**
86 86
 	 * Create an reaction.
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 	 *         The reaction object if created successfully. False or a validator
94 94
 	 *         instance if not.
95 95
 	 */
96
-	public function create_reaction( array $settings );
96
+	public function create_reaction(array $settings);
97 97
 
98 98
 	/**
99 99
 	 * Update an reaction.
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 	 *         The reaction object if updated successfully. False or a validator
108 108
 	 *         instance if not.
109 109
 	 */
110
-	public function update_reaction( $id, array $settings );
110
+	public function update_reaction($id, array $settings);
111 111
 
112 112
 	/**
113 113
 	 * Delete an reaction.
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
 	 *
119 119
 	 * @return bool Whether the reaction was deleted successfully.
120 120
 	 */
121
-	public function delete_reaction( $id );
121
+	public function delete_reaction($id);
122 122
 
123 123
 	/**
124 124
 	 * Get all hook reactions for the reactor.
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 	 *
142 142
 	 * @return WordPoints_Hook_ReactionI[]
143 143
 	 */
144
-	public function get_reactions_to_event( $event_slug );
144
+	public function get_reactions_to_event($event_slug);
145 145
 }
146 146
 
147 147
 // EOF
Please login to merge, or discard this patch.
src/includes/classes/hook/firer.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -17,14 +17,14 @@  discard block
 block discarded – undo
17 17
 	/**
18 18
 	 * @since 1.0.0
19 19
 	 */
20
-	public function do_event( $event_slug, WordPoints_Hook_Event_Args $event_args ) {
20
+	public function do_event($event_slug, WordPoints_Hook_Event_Args $event_args) {
21 21
 
22 22
 		$hooks = wordpoints_hooks();
23 23
 
24 24
 		/** @var WordPoints_Hook_Reactor $reactor */
25
-		foreach ( $hooks->reactors->get_all() as $reactor ) {
25
+		foreach ($hooks->reactors->get_all() as $reactor) {
26 26
 
27
-			foreach ( $reactor->get_all_reactions_to_event( $event_slug ) as $reaction ) {
27
+			foreach ($reactor->get_all_reactions_to_event($event_slug) as $reaction) {
28 28
 
29 29
 				$validator = new WordPoints_Hook_Reaction_Validator(
30 30
 					$reaction
@@ -34,25 +34,25 @@  discard block
 block discarded – undo
34 34
 
35 35
 				$validator->validate();
36 36
 
37
-				if ( $validator->had_errors() ) {
37
+				if ($validator->had_errors()) {
38 38
 					continue;
39 39
 				}
40 40
 
41
-				unset( $validator );
41
+				unset($validator);
42 42
 
43 43
 				/** @var WordPoints_Hook_Extension[] $extensions */
44 44
 				$extensions = $hooks->extensions->get_all();
45 45
 
46
-				foreach ( $extensions as $extension ) {
47
-					if ( ! $extension->should_hit( $reaction, $event_args ) ) {
46
+				foreach ($extensions as $extension) {
47
+					if ( ! $extension->should_hit($reaction, $event_args)) {
48 48
 						continue 2;
49 49
 					}
50 50
 				}
51 51
 
52
-				$reactor->hit( $event_args, $reaction );
52
+				$reactor->hit($event_args, $reaction);
53 53
 
54
-				foreach ( $extensions as $extension ) {
55
-					$extension->after_hit( $reaction, $event_args );
54
+				foreach ($extensions as $extension) {
55
+					$extension->after_hit($reaction, $event_args);
56 56
 				}
57 57
 			}
58 58
 		}
Please login to merge, or discard this patch.
src/includes/classes/hook/event/args.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -63,22 +63,22 @@  discard block
 block discarded – undo
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;
@@ -115,11 +115,11 @@  discard block
 block discarded – undo
115 115
 	 */
116 116
 	public function get_primary_arg() {
117 117
 
118
-		if ( ! $this->primary_arg_slug ) {
118
+		if ( ! $this->primary_arg_slug) {
119 119
 			return false;
120 120
 		}
121 121
 
122
-		return $this->entities[ $this->primary_arg_slug ];
122
+		return $this->entities[$this->primary_arg_slug];
123 123
 	}
124 124
 
125 125
 	/**
@@ -133,8 +133,8 @@  discard block
 block discarded – undo
133 133
 
134 134
 		$stateful = $this->entities;
135 135
 
136
-		if ( $this->primary_arg_slug ) {
137
-			unset( $stateful[ $this->primary_arg_slug ] );
136
+		if ($this->primary_arg_slug) {
137
+			unset($stateful[$this->primary_arg_slug]);
138 138
 		}
139 139
 
140 140
 		return $stateful;
@@ -147,54 +147,54 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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;
Please login to merge, or discard this patch.