Completed
Push — master ( e9e0b4...cbda97 )
by J.D.
03:49
created
src/classes/class/registryi.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 	 *
51 51
 	 * @return object|false The object or false if it is not registered.
52 52
 	 */
53
-	public function get( $slug );
53
+	public function get($slug);
54 54
 
55 55
 	/**
56 56
 	 * Register a type of object.
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 	 *
64 64
 	 * @return bool Whether the class was registered successfully.
65 65
 	 */
66
-	public function register( $slug, $class, array $args = array() );
66
+	public function register($slug, $class, array $args = array());
67 67
 
68 68
 	/**
69 69
 	 * Deregister a type of object
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 	 *
73 73
 	 * @param string $slug The slug of the class to deregister.
74 74
 	 */
75
-	public function deregister( $slug );
75
+	public function deregister($slug);
76 76
 
77 77
 	/**
78 78
 	 * Check if a type of object is registered by its slug.
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 	 *
84 84
 	 * @return bool Whether the class is registered.
85 85
 	 */
86
-	public function is_registered( $slug );
86
+	public function is_registered($slug);
87 87
 }
88 88
 
89 89
 // EOF
Please login to merge, or discard this patch.
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -71,6 +71,7 @@
 block discarded – undo
71 71
 	 * @since 2.1.0
72 72
 	 *
73 73
 	 * @param string $slug The slug of the class to deregister.
74
+	 * @return void
74 75
 	 */
75 76
 	public function deregister( $slug );
76 77
 
Please login to merge, or discard this patch.
src/classes/class/registry.php 1 patch
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -30,46 +30,46 @@  discard block
 block discarded – undo
30 30
 	/**
31 31
 	 * @since 2.1.0
32 32
 	 */
33
-	public function get_all( array $args = array() ) {
34
-		return self::construct_with_args( $this->classes, $args );
33
+	public function get_all(array $args = array()) {
34
+		return self::construct_with_args($this->classes, $args);
35 35
 	}
36 36
 
37 37
 	/**
38 38
 	 * @since 2.1.0
39 39
 	 */
40 40
 	public function get_all_slugs() {
41
-		return array_keys( $this->classes );
41
+		return array_keys($this->classes);
42 42
 	}
43 43
 
44 44
 	/**
45 45
 	 * @since 2.1.0
46 46
 	 */
47
-	public function get( $slug, array $args = array() ) {
47
+	public function get($slug, array $args = array()) {
48 48
 
49
-		if ( ! isset( $this->classes[ $slug ] ) ) {
49
+		if ( ! isset($this->classes[$slug])) {
50 50
 			return false;
51 51
 		}
52 52
 
53
-		if ( ! empty( $args ) ) {
53
+		if ( ! empty($args)) {
54 54
 
55
-			array_unshift( $args, $slug );
55
+			array_unshift($args, $slug);
56 56
 
57 57
 			return wordpoints_construct_class_with_args(
58
-				$this->classes[ $slug ]
58
+				$this->classes[$slug]
59 59
 				, $args
60 60
 			);
61 61
 
62 62
 		} else {
63
-			return new $this->classes[ $slug ]( $slug );
63
+			return new $this->classes[$slug]($slug);
64 64
 		}
65 65
 	}
66 66
 
67 67
 	/**
68 68
 	 * @since 2.1.0
69 69
 	 */
70
-	public function register( $slug, $class, array $args = array() ) {
70
+	public function register($slug, $class, array $args = array()) {
71 71
 
72
-		$this->classes[ $slug ] = $class;
72
+		$this->classes[$slug] = $class;
73 73
 
74 74
 		return true;
75 75
 	}
@@ -77,17 +77,17 @@  discard block
 block discarded – undo
77 77
 	/**
78 78
 	 * @since 2.1.0
79 79
 	 */
80
-	public function deregister( $slug ) {
80
+	public function deregister($slug) {
81 81
 
82
-		unset( $this->classes[ $slug ] );
82
+		unset($this->classes[$slug]);
83 83
 	}
84 84
 
85 85
 	/**
86 86
 	 * @since 2.1.0
87 87
 	 */
88
-	public function is_registered( $slug ) {
88
+	public function is_registered($slug) {
89 89
 
90
-		return isset( $this->classes[ $slug ] );
90
+		return isset($this->classes[$slug]);
91 91
 	}
92 92
 
93 93
 	/**
@@ -114,39 +114,39 @@  discard block
 block discarded – undo
114 114
 		array $args = array()
115 115
 	) {
116 116
 
117
-		$pass_slugs = ( ! isset( $args['pass_slugs'] ) || $args['pass_slugs'] );
117
+		$pass_slugs = ( ! isset($args['pass_slugs']) || $args['pass_slugs']);
118 118
 
119 119
 		$objects = array();
120 120
 
121
-		if ( empty( $construct_with_args ) ) {
121
+		if (empty($construct_with_args)) {
122 122
 
123
-			if ( $pass_slugs ) {
124
-				foreach ( $classes as $slug => $class ) {
125
-					$objects[ $slug ] = new $class( $slug );
123
+			if ($pass_slugs) {
124
+				foreach ($classes as $slug => $class) {
125
+					$objects[$slug] = new $class($slug);
126 126
 				}
127 127
 			} else {
128
-				foreach ( $classes as $slug => $class ) {
129
-					$objects[ $slug ] = new $class();
128
+				foreach ($classes as $slug => $class) {
129
+					$objects[$slug] = new $class();
130 130
 				}
131 131
 			}
132 132
 
133 133
 		} else {
134 134
 
135
-			if ( $pass_slugs ) {
135
+			if ($pass_slugs) {
136 136
 
137
-				array_unshift( $construct_with_args, null );
137
+				array_unshift($construct_with_args, null);
138 138
 
139
-				foreach ( $classes as $slug => $class ) {
140
-					$objects[ $slug ] = wordpoints_construct_class_with_args(
139
+				foreach ($classes as $slug => $class) {
140
+					$objects[$slug] = wordpoints_construct_class_with_args(
141 141
 						$class
142
-						, array( $slug ) + $construct_with_args
142
+						, array($slug) + $construct_with_args
143 143
 					);
144 144
 				}
145 145
 
146 146
 			} else {
147 147
 
148
-				foreach ( $classes as $slug => $class ) {
149
-					$objects[ $slug ] = wordpoints_construct_class_with_args(
148
+				foreach ($classes as $slug => $class) {
149
+					$objects[$slug] = wordpoints_construct_class_with_args(
150 150
 						$class
151 151
 						, $construct_with_args
152 152
 					);
Please login to merge, or discard this patch.
src/classes/entity.php 2 patches
Spacing   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -108,11 +108,11 @@  discard block
 block discarded – undo
108 108
 	 *
109 109
 	 * @return mixed The entity, or false if not found.
110 110
 	 */
111
-	protected function get_entity( $id ) {
111
+	protected function get_entity($id) {
112 112
 
113
-		$entity = call_user_func( $this->getter, $id );
113
+		$entity = call_user_func($this->getter, $id);
114 114
 
115
-		if ( ! $this->is_entity( $entity ) ) {
115
+		if ( ! $this->is_entity($entity)) {
116 116
 			return false;
117 117
 		}
118 118
 
@@ -128,13 +128,13 @@  discard block
 block discarded – undo
128 128
 	 *
129 129
 	 * @return bool Whether the passed value is an entity.
130 130
 	 */
131
-	protected function is_entity( $entity ) {
131
+	protected function is_entity($entity) {
132 132
 
133
-		if ( ! is_object( $entity ) && ! is_array( $entity ) ) {
133
+		if ( ! is_object($entity) && ! is_array($entity)) {
134 134
 			return false;
135 135
 		}
136 136
 
137
-		return (bool) $this->get_entity_id( $entity );
137
+		return (bool) $this->get_entity_id($entity);
138 138
 	}
139 139
 
140 140
 	/**
@@ -151,16 +151,16 @@  discard block
 block discarded – undo
151 151
 	 *
152 152
 	 * @return mixed The entity, or false if not found.
153 153
 	 */
154
-	protected function get_entity_from_context( $id, $context ) {
154
+	protected function get_entity_from_context($id, $context) {
155 155
 
156 156
 		/** @var WordPoints_Entity_Contexts $contexts */
157
-		$contexts = wordpoints_entities()->get_sub_app( 'contexts' );
157
+		$contexts = wordpoints_entities()->get_sub_app('contexts');
158 158
 
159
-		if ( ! $contexts->switch_to( $context ) ) {
159
+		if ( ! $contexts->switch_to($context)) {
160 160
 			return false;
161 161
 		}
162 162
 
163
-		$entity = $this->get_entity( $id );
163
+		$entity = $this->get_entity($id);
164 164
 
165 165
 		$contexts->switch_back();
166 166
 
@@ -176,13 +176,13 @@  discard block
 block discarded – undo
176 176
 	 *
177 177
 	 * @return bool Whether the passed value is a GUID for an entity of this type.
178 178
 	 */
179
-	protected function is_guid( $guid ) {
179
+	protected function is_guid($guid) {
180 180
 
181
-		if ( ! is_array( $guid ) ) {
181
+		if ( ! is_array($guid)) {
182 182
 			return false;
183 183
 		}
184 184
 
185
-		return isset( $guid[ $this->get_slug() ], $guid[ $this->get_context() ] );
185
+		return isset($guid[$this->get_slug()], $guid[$this->get_context()]);
186 186
 	}
187 187
 
188 188
 	/**
@@ -197,15 +197,15 @@  discard block
 block discarded – undo
197 197
 	 *         @type array      $context The entity context.
198 198
 	 * }
199 199
 	 */
200
-	protected function split_guid( $guid ) {
200
+	protected function split_guid($guid) {
201 201
 
202 202
 		$slug    = $this->get_slug();
203
-		$id      = $guid[ $slug ];
203
+		$id      = $guid[$slug];
204 204
 		$context = $guid;
205 205
 
206
-		unset( $context[ $slug ] );
206
+		unset($context[$slug]);
207 207
 
208
-		return array( 'id' => $id, 'context' => $context );
208
+		return array('id' => $id, 'context' => $context);
209 209
 	}
210 210
 
211 211
 	/**
@@ -218,14 +218,14 @@  discard block
 block discarded – undo
218 218
 	 *
219 219
 	 * @return mixed The value of the attribute of the entity.
220 220
 	 */
221
-	protected function get_attr_value( $entity, $attr ) {
221
+	protected function get_attr_value($entity, $attr) {
222 222
 
223
-		if ( is_array( $entity ) ) {
224
-			if ( isset( $entity[ $attr ] ) ) {
225
-				return $entity[ $attr ];
223
+		if (is_array($entity)) {
224
+			if (isset($entity[$attr])) {
225
+				return $entity[$attr];
226 226
 			}
227 227
 		} else {
228
-			if ( isset( $entity->{$attr} ) ) {
228
+			if (isset($entity->{$attr} )) {
229 229
 				return $entity->{$attr};
230 230
 			}
231 231
 		}
@@ -242,8 +242,8 @@  discard block
 block discarded – undo
242 242
 	 *
243 243
 	 * @return mixed The ID of the entity.
244 244
 	 */
245
-	protected function get_entity_id( $entity ) {
246
-		return $this->get_attr_value( $entity, $this->get_id_field() );
245
+	protected function get_entity_id($entity) {
246
+		return $this->get_attr_value($entity, $this->get_id_field());
247 247
 	}
248 248
 
249 249
 	/**
@@ -259,8 +259,8 @@  discard block
 block discarded – undo
259 259
 	 *
260 260
 	 * @return mixed The human ID of the entity.
261 261
 	 */
262
-	protected function get_entity_human_id( $entity ) {
263
-		return $this->get_attr_value( $entity, $this->human_id_field );
262
+	protected function get_entity_human_id($entity) {
263
+		return $this->get_attr_value($entity, $this->human_id_field);
264 264
 	}
265 265
 
266 266
 	//
@@ -302,15 +302,15 @@  discard block
 block discarded – undo
302 302
 	 *
303 303
 	 * @return string|int|float|false The human identifier for the entity, or false.
304 304
 	 */
305
-	public function get_human_id( $id ) {
305
+	public function get_human_id($id) {
306 306
 
307
-		$entity = $this->get_entity( $id );
307
+		$entity = $this->get_entity($id);
308 308
 
309
-		if ( ! $entity ) {
309
+		if ( ! $entity) {
310 310
 			return false;
311 311
 		}
312 312
 
313
-		return $this->get_entity_human_id( $entity );
313
+		return $this->get_entity_human_id($entity);
314 314
 	}
315 315
 
316 316
 	/**
@@ -322,8 +322,8 @@  discard block
 block discarded – undo
322 322
 	 *
323 323
 	 * @return bool Whether or not an entity with that ID exists.
324 324
 	 */
325
-	public function exists( $id ) {
326
-		return (bool) $this->get_entity( $id );
325
+	public function exists($id) {
326
+		return (bool) $this->get_entity($id);
327 327
 	}
328 328
 
329 329
 	/**
@@ -338,17 +338,17 @@  discard block
 block discarded – undo
338 338
 	 *
339 339
 	 * @return WordPoints_Entityish|false The child's object, or false if not found.
340 340
 	 */
341
-	public function get_child( $child_slug ) {
341
+	public function get_child($child_slug) {
342 342
 
343
-		$children = wordpoints_entities()->get_sub_app( 'children' );
343
+		$children = wordpoints_entities()->get_sub_app('children');
344 344
 
345
-		$child = $children->get( $this->slug, $child_slug );
345
+		$child = $children->get($this->slug, $child_slug);
346 346
 
347 347
 		if (
348
-			isset( $this->the_value )
348
+			isset($this->the_value)
349 349
 			&& $child instanceof WordPoints_Entity_ChildI
350 350
 		) {
351
-			$child->set_the_value_from_entity( $this );
351
+			$child->set_the_value_from_entity($this);
352 352
 		}
353 353
 
354 354
 		return $child;
@@ -371,33 +371,33 @@  discard block
 block discarded – undo
371 371
 	 *
372 372
 	 * @return bool Whether the value was set.
373 373
 	 */
374
-	public function set_the_value( $value ) {
374
+	public function set_the_value($value) {
375 375
 
376 376
 		$this->the_value = $this->the_entity = $this->the_context = null;
377 377
 
378
-		if ( $this->is_entity( $value ) ) {
378
+		if ($this->is_entity($value)) {
379 379
 
380 380
 			$entity = $value;
381
-			$value = $this->get_entity_id( $value );
381
+			$value = $this->get_entity_id($value);
382 382
 
383
-		} elseif ( $this->is_guid( $value ) ) {
383
+		} elseif ($this->is_guid($value)) {
384 384
 
385
-			$guid = $this->split_guid( $value );
385
+			$guid = $this->split_guid($value);
386 386
 			$context = $guid['context'];
387 387
 			$value   = $guid['id'];
388 388
 
389
-			$entity = $this->get_entity_from_context( $guid['id'], $context );
389
+			$entity = $this->get_entity_from_context($guid['id'], $context);
390 390
 
391 391
 		} else {
392 392
 
393
-			$entity = $this->get_entity( $value );
393
+			$entity = $this->get_entity($value);
394 394
 		}
395 395
 
396
-		if ( ! $entity ) {
396
+		if ( ! $entity) {
397 397
 			return false;
398 398
 		}
399 399
 
400
-		if ( ! isset( $context ) ) {
400
+		if ( ! isset($context)) {
401 401
 			$context = wordpoints_entities_get_current_context_id(
402 402
 				$this->get_context()
403 403
 			);
@@ -419,8 +419,8 @@  discard block
 block discarded – undo
419 419
 	 *
420 420
 	 * @return mixed The value of the attribute.
421 421
 	 */
422
-	public function get_the_attr_value( $attr ) {
423
-		return $this->get_attr_value( $this->the_entity, $attr );
422
+	public function get_the_attr_value($attr) {
423
+		return $this->get_attr_value($this->the_entity, $attr);
424 424
 	}
425 425
 
426 426
 	/**
@@ -444,7 +444,7 @@  discard block
 block discarded – undo
444 444
 	 * @return string|int|float|null The human identifier for the entity, or null.
445 445
 	 */
446 446
 	public function get_the_human_id() {
447
-		return $this->get_entity_human_id( $this->the_entity );
447
+		return $this->get_entity_human_id($this->the_entity);
448 448
 	}
449 449
 
450 450
 	/**
@@ -478,11 +478,11 @@  discard block
 block discarded – undo
478 478
 
479 479
 		$guid = $this->get_the_context();
480 480
 
481
-		if ( ! is_array( $guid ) ) {
481
+		if ( ! is_array($guid)) {
482 482
 			return $guid;
483 483
 		}
484 484
 
485
-		$guid = array( $this->slug => $this->get_the_id() ) + $guid;
485
+		$guid = array($this->slug => $this->get_the_id()) + $guid;
486 486
 
487 487
 		return $guid;
488 488
 	}
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -430,7 +430,7 @@
 block discarded – undo
430 430
 	 *
431 431
 	 * @since 2.1.0
432 432
 	 *
433
-	 * @return mixed The ID of the entity.
433
+	 * @return integer The ID of the entity.
434 434
 	 */
435 435
 	public function get_the_id() {
436 436
 		return $this->get_the_value();
Please login to merge, or discard this patch.
src/classes/data/typei.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@
 block discarded – undo
42 42
 	 *
43 43
 	 * @return mixed|WP_Error The validated value or a WP_Error on failure.
44 44
 	 */
45
-	public function validate_value( $value );
45
+	public function validate_value($value);
46 46
 }
47 47
 
48 48
 // EOF
Please login to merge, or discard this patch.
src/classes/data/type/integer.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -17,14 +17,14 @@
 block discarded – undo
17 17
 	/**
18 18
 	 * @since 2.1.0
19 19
 	 */
20
-	public function validate_value( $value ) {
20
+	public function validate_value($value) {
21 21
 
22
-		wordpoints_int( $value );
22
+		wordpoints_int($value);
23 23
 
24
-		if ( false === $value ) {
24
+		if (false === $value) {
25 25
 			return new WP_Error(
26 26
 				'not_integer'
27
-				, __( '%s must be an integer.', 'wordpoints' )
27
+				, __('%s must be an integer.', 'wordpoints')
28 28
 			);
29 29
 		}
30 30
 
Please login to merge, or discard this patch.
src/classes/data/type/text.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -20,12 +20,12 @@
 block discarded – undo
20 20
 	/**
21 21
 	 * @since 2.1.0
22 22
 	 */
23
-	public function validate_value( $value ) {
23
+	public function validate_value($value) {
24 24
 
25
-		if ( ! is_string( $value ) ) {
25
+		if ( ! is_string($value)) {
26 26
 			return new WP_Error(
27 27
 				'not_string'
28
-				, __( '%s must be a text value.', 'wordpoints' )
28
+				, __('%s must be a text value.', 'wordpoints')
29 29
 			);
30 30
 		}
31 31
 
Please login to merge, or discard this patch.
src/classes/hook/reactori.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -76,7 +76,7 @@
 block discarded – undo
76 76
 	 *
77 77
 	 * @param WordPoints_Hook_Fire $fire The hook fire object.
78 78
 	 */
79
-	public function hit( WordPoints_Hook_Fire $fire );
79
+	public function hit(WordPoints_Hook_Fire $fire);
80 80
 }
81 81
 
82 82
 // EOF
Please login to merge, or discard this patch.
src/classes/hook/router.php 1 patch
Spacing   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -89,13 +89,13 @@  discard block
 block discarded – undo
89 89
 	/**
90 90
 	 * @since 2.1.0
91 91
 	 */
92
-	public function __call( $name, $args ) {
92
+	public function __call($name, $args) {
93 93
 
94
-		$this->route_action( $name, $args );
94
+		$this->route_action($name, $args);
95 95
 
96 96
 		// Return the first value, in case it is hooked to a filter.
97 97
 		$return = null;
98
-		if ( isset( $args[0] ) ) {
98
+		if (isset($args[0])) {
99 99
 			$return = $args[0];
100 100
 		}
101 101
 
@@ -112,9 +112,9 @@  discard block
 block discarded – undo
112 112
 	 *                     action name and the priority.
113 113
 	 * @param array  $args The args the action was fired with.
114 114
 	 */
115
-	protected function route_action( $name, $args ) {
115
+	protected function route_action($name, $args) {
116 116
 
117
-		if ( ! isset( $this->action_index[ $name ] ) ) {
117
+		if ( ! isset($this->action_index[$name])) {
118 118
 			return;
119 119
 		}
120 120
 
@@ -122,48 +122,48 @@  discard block
 block discarded – undo
122 122
 		// registry attempts to access the router in its own constructor. The result
123 123
 		// of attempting to do this before the router itself has been fully
124 124
 		// constructed is that the events registry gets null instead of the router.
125
-		if ( ! isset( $this->hooks ) ) {
125
+		if ( ! isset($this->hooks)) {
126 126
 
127 127
 			$hooks = wordpoints_hooks();
128 128
 
129 129
 			$this->hooks   = $hooks;
130
-			$this->events  = $hooks->get_sub_app( 'events' );
131
-			$this->actions = $hooks->get_sub_app( 'actions' );
132
-			$this->event_args = $this->events->get_sub_app( 'args' );
130
+			$this->events  = $hooks->get_sub_app('events');
131
+			$this->actions = $hooks->get_sub_app('actions');
132
+			$this->event_args = $this->events->get_sub_app('args');
133 133
 		}
134 134
 
135
-		foreach ( $this->action_index[ $name ]['actions'] as $slug => $data ) {
135
+		foreach ($this->action_index[$name]['actions'] as $slug => $data) {
136 136
 
137
-			if ( ! isset( $this->event_index[ $slug ] ) ) {
137
+			if ( ! isset($this->event_index[$slug])) {
138 138
 				continue;
139 139
 			}
140 140
 
141
-			$action_object = $this->actions->get( $slug, $args, $data );
141
+			$action_object = $this->actions->get($slug, $args, $data);
142 142
 
143
-			if ( ! ( $action_object instanceof WordPoints_Hook_ActionI ) ) {
143
+			if ( ! ($action_object instanceof WordPoints_Hook_ActionI)) {
144 144
 				continue;
145 145
 			}
146 146
 
147
-			if ( ! $action_object->should_fire() ) {
147
+			if ( ! $action_object->should_fire()) {
148 148
 				continue;
149 149
 			}
150 150
 
151
-			foreach ( $this->event_index[ $slug ] as $type => $events ) {
152
-				foreach ( $events as $event_slug => $unused ) {
151
+			foreach ($this->event_index[$slug] as $type => $events) {
152
+				foreach ($events as $event_slug => $unused) {
153 153
 
154
-					if ( ! $this->events->is_registered( $event_slug ) ) {
154
+					if ( ! $this->events->is_registered($event_slug)) {
155 155
 						continue;
156 156
 					}
157 157
 
158
-					$event_args = $this->event_args->get_children( $event_slug, array( $action_object ) );
158
+					$event_args = $this->event_args->get_children($event_slug, array($action_object));
159 159
 
160
-					if ( empty( $event_args ) ) {
160
+					if (empty($event_args)) {
161 161
 						continue;
162 162
 					}
163 163
 
164
-					$event_args = new WordPoints_Hook_Event_Args( $event_args );
164
+					$event_args = new WordPoints_Hook_Event_Args($event_args);
165 165
 
166
-					$this->hooks->fire( $event_slug, $event_args, $type );
166
+					$this->hooks->fire($event_slug, $event_args, $type);
167 167
 				}
168 168
 			}
169 169
 		}
@@ -192,56 +192,56 @@  discard block
 block discarded – undo
192 192
 	 *        }
193 193
 	 * }
194 194
 	 */
195
-	public function add_action( $slug, array $args ) {
195
+	public function add_action($slug, array $args) {
196 196
 
197 197
 		$priority = 10;
198
-		if ( isset( $args['priority'] ) ) {
198
+		if (isset($args['priority'])) {
199 199
 			$priority = $args['priority'];
200 200
 		}
201 201
 
202
-		if ( ! isset( $args['action'] ) ) {
202
+		if ( ! isset($args['action'])) {
203 203
 			return;
204 204
 		}
205 205
 
206 206
 		$method = "{$args['action']},{$priority}";
207 207
 
208
-		$this->action_index[ $method ]['actions'][ $slug ] = array();
208
+		$this->action_index[$method]['actions'][$slug] = array();
209 209
 
210 210
 		$arg_number = 1;
211 211
 
212
-		if ( isset( $args['data'] ) ) {
212
+		if (isset($args['data'])) {
213 213
 
214
-			if ( isset( $args['data']['arg_index'] ) ) {
215
-				$arg_number = 1 + max( $args['data']['arg_index'] );
214
+			if (isset($args['data']['arg_index'])) {
215
+				$arg_number = 1 + max($args['data']['arg_index']);
216 216
 			}
217 217
 
218
-			if ( isset( $args['data']['requirements'] ) ) {
219
-				$requirements = 1 + max( array_keys( $args['data']['requirements'] ) );
218
+			if (isset($args['data']['requirements'])) {
219
+				$requirements = 1 + max(array_keys($args['data']['requirements']));
220 220
 
221
-				if ( $requirements > $arg_number ) {
221
+				if ($requirements > $arg_number) {
222 222
 					$arg_number = $requirements;
223 223
 				}
224 224
 			}
225 225
 
226
-			$this->action_index[ $method ]['actions'][ $slug ] = $args['data'];
226
+			$this->action_index[$method]['actions'][$slug] = $args['data'];
227 227
 		}
228 228
 
229
-		if ( isset( $args['arg_number'] ) ) {
229
+		if (isset($args['arg_number'])) {
230 230
 			$arg_number = $args['arg_number'];
231 231
 		}
232 232
 
233 233
 		// If this action is already being routed, and will have enough args, we
234 234
 		// don't need to hook to it again.
235 235
 		if (
236
-			isset( $this->action_index[ $method ]['arg_number'] )
237
-			&& $this->action_index[ $method ]['arg_number'] >= $arg_number
236
+			isset($this->action_index[$method]['arg_number'])
237
+			&& $this->action_index[$method]['arg_number'] >= $arg_number
238 238
 		) {
239 239
 			return;
240 240
 		}
241 241
 
242
-		$this->action_index[ $method ]['arg_number'] = $arg_number;
242
+		$this->action_index[$method]['arg_number'] = $arg_number;
243 243
 
244
-		add_action( $args['action'], array( $this, $method ), $priority, $arg_number );
244
+		add_action($args['action'], array($this, $method), $priority, $arg_number);
245 245
 	}
246 246
 
247 247
 	/**
@@ -251,20 +251,20 @@  discard block
 block discarded – undo
251 251
 	 *
252 252
 	 * @param string $slug The action slug.
253 253
 	 */
254
-	public function remove_action( $slug ) {
254
+	public function remove_action($slug) {
255 255
 
256
-		foreach ( $this->action_index as $method => $data ) {
257
-			if ( isset( $data['actions'][ $slug ] ) ) {
256
+		foreach ($this->action_index as $method => $data) {
257
+			if (isset($data['actions'][$slug])) {
258 258
 
259
-				unset( $this->action_index[ $method ]['actions'][ $slug ] );
259
+				unset($this->action_index[$method]['actions'][$slug]);
260 260
 
261
-				if ( empty( $this->action_index[ $method ]['actions'] ) ) {
261
+				if (empty($this->action_index[$method]['actions'])) {
262 262
 
263
-					unset( $this->action_index[ $method ] );
263
+					unset($this->action_index[$method]);
264 264
 
265
-					list( $action, $priority ) = explode( ',', $method );
265
+					list($action, $priority) = explode(',', $method);
266 266
 
267
-					remove_action( $action, array( $this, $method ), $priority );
267
+					remove_action($action, array($this, $method), $priority);
268 268
 				}
269 269
 			}
270 270
 		}
@@ -279,8 +279,8 @@  discard block
 block discarded – undo
279 279
 	 * @param string $action_slug The slug of the action.
280 280
 	 * @param string $action_type The type of action. Default is 'fire'.
281 281
 	 */
282
-	public function add_event_to_action( $event_slug, $action_slug, $action_type = 'fire' ) {
283
-		$this->event_index[ $action_slug ][ $action_type ][ $event_slug ] = true;
282
+	public function add_event_to_action($event_slug, $action_slug, $action_type = 'fire') {
283
+		$this->event_index[$action_slug][$action_type][$event_slug] = true;
284 284
 	}
285 285
 
286 286
 	/**
@@ -292,8 +292,8 @@  discard block
 block discarded – undo
292 292
 	 * @param string $action_slug The slug of the action.
293 293
 	 * @param string $action_type The type of action. Default is 'fire'.
294 294
 	 */
295
-	public function remove_event_from_action( $event_slug, $action_slug, $action_type = 'fire' ) {
296
-		unset( $this->event_index[ $action_slug ][ $action_type ][ $event_slug ] );
295
+	public function remove_event_from_action($event_slug, $action_slug, $action_type = 'fire') {
296
+		unset($this->event_index[$action_slug][$action_type][$event_slug]);
297 297
 	}
298 298
 
299 299
 	/**
@@ -305,8 +305,8 @@  discard block
 block discarded – undo
305 305
 	 */
306 306
 	public function get_event_index() {
307 307
 
308
-		if ( empty( $this->event_index ) ) {
309
-			wordpoints_hooks()->get_sub_app( 'events' );
308
+		if (empty($this->event_index)) {
309
+			wordpoints_hooks()->get_sub_app('events');
310 310
 		}
311 311
 
312 312
 		return $this->event_index;
Please login to merge, or discard this patch.
src/classes/hook/extension.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -57,14 +57,14 @@  discard block
 block discarded – undo
57 57
 		WordPoints_Hook_Event_Args $event_args
58 58
 	) {
59 59
 
60
-		if ( ! isset( $settings[ $this->slug ] ) ) {
60
+		if ( ! isset($settings[$this->slug])) {
61 61
 			return $settings;
62 62
 		}
63 63
 
64
-		if ( ! is_array( $settings[ $this->slug ] ) ) {
64
+		if ( ! is_array($settings[$this->slug])) {
65 65
 
66 66
 			$validator->add_error(
67
-				__( 'Invalid settings format.', 'wordpoints' )
67
+				__('Invalid settings format.', 'wordpoints')
68 68
 				, $this->slug
69 69
 			);
70 70
 
@@ -74,13 +74,13 @@  discard block
 block discarded – undo
74 74
 		$this->validator = $validator;
75 75
 		$this->event_args = $event_args;
76 76
 
77
-		$this->validator->push_field( $this->slug );
77
+		$this->validator->push_field($this->slug);
78 78
 
79
-		foreach ( $settings[ $this->slug ] as $action_type => $action_type_settings ) {
79
+		foreach ($settings[$this->slug] as $action_type => $action_type_settings) {
80 80
 
81
-			$this->validator->push_field( $action_type );
81
+			$this->validator->push_field($action_type);
82 82
 
83
-			$settings[ $this->slug ][ $action_type ] = $this->validate_action_type_settings(
83
+			$settings[$this->slug][$action_type] = $this->validate_action_type_settings(
84 84
 				$action_type_settings
85 85
 			);
86 86
 
@@ -95,12 +95,12 @@  discard block
 block discarded – undo
95 95
 	/**
96 96
 	 * @since 2.1.0
97 97
 	 */
98
-	public function update_settings( WordPoints_Hook_ReactionI $reaction, array $settings ) {
98
+	public function update_settings(WordPoints_Hook_ReactionI $reaction, array $settings) {
99 99
 
100
-		if ( isset( $settings[ $this->slug ] ) ) {
101
-			$reaction->update_meta( $this->slug, $settings[ $this->slug ] );
100
+		if (isset($settings[$this->slug])) {
101
+			$reaction->update_meta($this->slug, $settings[$this->slug]);
102 102
 		} else {
103
-			$reaction->delete_meta( $this->slug );
103
+			$reaction->delete_meta($this->slug);
104 104
 		}
105 105
 	}
106 106
 
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 	 *
114 114
 	 * @return mixed The validated settings.
115 115
 	 */
116
-	protected function validate_action_type_settings( $settings ) {
116
+	protected function validate_action_type_settings($settings) {
117 117
 		return $settings;
118 118
 	}
119 119
 
@@ -130,16 +130,16 @@  discard block
 block discarded – undo
130 130
 	 *
131 131
 	 * @return mixed The settings for the extension, or false if none.
132 132
 	 */
133
-	protected function get_settings_from_fire( WordPoints_Hook_Fire $fire ) {
133
+	protected function get_settings_from_fire(WordPoints_Hook_Fire $fire) {
134 134
 
135
-		$settings = $fire->reaction->get_meta( $this->slug );
135
+		$settings = $fire->reaction->get_meta($this->slug);
136 136
 
137
-		if ( ! is_array( $settings ) ) {
137
+		if ( ! is_array($settings)) {
138 138
 			return $settings;
139 139
 		}
140 140
 
141
-		if ( isset( $settings[ $fire->action_type ] ) ) {
142
-			return $settings[ $fire->action_type ];
141
+		if (isset($settings[$fire->action_type])) {
142
+			return $settings[$fire->action_type];
143 143
 		} else {
144 144
 			return false;
145 145
 		}
Please login to merge, or discard this patch.