Completed
Push — master ( 5b2818...3f335f )
by J.D.
03:35
created
src/includes/classes/hook/settings.php 1 patch
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -8,13 +8,13 @@  discard block
 block discarded – undo
8 8
  */
9 9
 
10 10
 interface WordPoints_Hook_Reaction_SettingI {
11
-	public function __construct( $slug );
11
+	public function __construct($slug);
12 12
 	public function get_type();
13 13
 	public function get_label();
14 14
 	public function is_required();
15
-	public function get( WordPoints_Hook_ReactionI $reaction );
16
-	public function validate( $value, WordPoints_Hook_Reaction_Validator $validator );
17
-	public function save( $value, WordPoints_Hook_ReactionI $reaction, $is_new );
15
+	public function get(WordPoints_Hook_ReactionI $reaction);
16
+	public function validate($value, WordPoints_Hook_Reaction_Validator $validator);
17
+	public function save($value, WordPoints_Hook_ReactionI $reaction, $is_new);
18 18
 }
19 19
 
20 20
 class WordPoints_Hook_Reaction_Setting implements WordPoints_Hook_Reaction_SettingI {
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
 	protected $type = 'hidden';
24 24
 	protected $required = true;
25 25
 
26
-	public function __construct( $slug ) {
26
+	public function __construct($slug) {
27 27
 		$this->slug = $slug;
28 28
 	}
29 29
 
@@ -39,17 +39,17 @@  discard block
 block discarded – undo
39 39
 		return $this->required;
40 40
 	}
41 41
 
42
-	public function get( WordPoints_Hook_ReactionI $reaction ) {
43
-		return $reaction->get_meta( $this->slug );
42
+	public function get(WordPoints_Hook_ReactionI $reaction) {
43
+		return $reaction->get_meta($this->slug);
44 44
 	}
45 45
 
46
-	public function validate( $value, WordPoints_Hook_Reaction_Validator $validator ) {
46
+	public function validate($value, WordPoints_Hook_Reaction_Validator $validator) {
47 47
 
48
-		if ( $this->is_required() && '' === trim( $value ) ) {
48
+		if ($this->is_required() && '' === trim($value)) {
49 49
 
50 50
 			$validator->add_error(
51 51
 				sprintf(
52
-					__( '%s cannot be empty.', 'wordpoints' )
52
+					__('%s cannot be empty.', 'wordpoints')
53 53
 					, $this->get_label()
54 54
 				)
55 55
 				, $this->slug
@@ -59,8 +59,8 @@  discard block
 block discarded – undo
59 59
 		return $value;
60 60
 	}
61 61
 
62
-	public function save( $value, WordPoints_Hook_ReactionI $reaction, $is_new ) {
63
-		$reaction->update_meta( $this->slug, $value );
62
+	public function save($value, WordPoints_Hook_ReactionI $reaction, $is_new) {
63
+		$reaction->update_meta($this->slug, $value);
64 64
 	}
65 65
 }
66 66
 //
@@ -82,12 +82,12 @@  discard block
 block discarded – undo
82 82
 
83 83
 		$fields = array();
84 84
 
85
-		foreach ( $this->settings as $slug => $class ) {
85
+		foreach ($this->settings as $slug => $class) {
86 86
 
87 87
 			/** @var WordPoints_Hook_Reaction_SettingI $setting */
88
-			$setting = new $class( $slug );
88
+			$setting = new $class($slug);
89 89
 
90
-			$fields[ $slug ] = array(
90
+			$fields[$slug] = array(
91 91
 				'type' => $setting->get_type(),
92 92
 				'label' => $setting->get_label(),
93 93
 				'required' => $setting->is_required(),
@@ -97,29 +97,29 @@  discard block
 block discarded – undo
97 97
 		return $fields;
98 98
 	}
99 99
 
100
-	public function save_settings( $reaction, $settings, $is_new ) {
100
+	public function save_settings($reaction, $settings, $is_new) {
101 101
 
102
-		foreach ( $this->settings as $slug => $class ) {
102
+		foreach ($this->settings as $slug => $class) {
103 103
 
104 104
 			/** @var WordPoints_Hook_Reaction_SettingI $setting */
105
-			$setting = new $class( $slug );
105
+			$setting = new $class($slug);
106 106
 
107
-			$value = isset( $settings[ $slug ] ) ? $settings[ $slug ] : null;
107
+			$value = isset($settings[$slug]) ? $settings[$slug] : null;
108 108
 
109
-			$setting->save( $value, $reaction, $is_new );
109
+			$setting->save($value, $reaction, $is_new);
110 110
 		}
111 111
 	}
112 112
 
113
-	public function validate_settings( $settings, $validator ) {
113
+	public function validate_settings($settings, $validator) {
114 114
 
115
-		foreach ( $this->settings as $slug => $class ) {
115
+		foreach ($this->settings as $slug => $class) {
116 116
 
117 117
 			/** @var WordPoints_Hook_Reaction_SettingI $setting */
118
-			$setting = new $class( $slug );
118
+			$setting = new $class($slug);
119 119
 
120
-			$value = isset( $settings[ $slug ] ) ? $settings[ $slug ] : null;
120
+			$value = isset($settings[$slug]) ? $settings[$slug] : null;
121 121
 
122
-			$settings[ $slug ] = $setting->validate( $value, $validator );
122
+			$settings[$slug] = $setting->validate($value, $validator);
123 123
 		}
124 124
 
125 125
 		return $settings;
@@ -133,8 +133,8 @@  discard block
 block discarded – undo
133 133
  *
134 134
  * @param WordPoints_Hooks $hooks
135 135
  */
136
-function wordpoints_hook_settings_app( $hooks ) {
137
-	$hooks->sub_apps()->register( 'settings', 'WordPoints_Hook_Settings' );
136
+function wordpoints_hook_settings_app($hooks) {
137
+	$hooks->sub_apps()->register('settings', 'WordPoints_Hook_Settings');
138 138
 }
139 139
 //add_action( 'wordpoints_hooks_init', 'wordpoints_hook_settings_app' );
140 140
 
@@ -145,12 +145,12 @@  discard block
 block discarded – undo
145 145
  *
146 146
  * @param WordPoints_Hook_Settings $settings
147 147
  */
148
-function wordpoints_register_hook_settings( $settings ) {
148
+function wordpoints_register_hook_settings($settings) {
149 149
 
150
-	add_action( 'wordpoints_hook_reaction_save', array( $settings, 'save_settings' ), 10, 3 );
151
-	add_filter( 'wordpoints_hook_reaction_validate', array( $settings, 'validate_settings' ), 10, 2 );
150
+	add_action('wordpoints_hook_reaction_save', array($settings, 'save_settings'), 10, 3);
151
+	add_filter('wordpoints_hook_reaction_validate', array($settings, 'validate_settings'), 10, 2);
152 152
 
153
-	$settings->register( 'description', 'WordPoints_Hook_Reaction_Setting_Description' );
153
+	$settings->register('description', 'WordPoints_Hook_Reaction_Setting_Description');
154 154
 }
155 155
 //add_action( 'wordpoints_hook_settings_init', 'wordpoints_register_hook_settings' );
156 156
 
Please login to merge, or discard this patch.
src/includes/classes/hook/condition/entity/array/contains.php 1 patch
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 	 */
48 48
 	public function __construct() {
49 49
 
50
-		$this->conditions_extension = wordpoints_hooks()->get_sub_app( 'extensions' )->get(
50
+		$this->conditions_extension = wordpoints_hooks()->get_sub_app('extensions')->get(
51 51
 			'conditions'
52 52
 		);
53 53
 	}
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 	 * @since 1.0.0
57 57
 	 */
58 58
 	public function get_title() {
59
-		return __( 'Contains', 'wordpoints' );
59
+		return __('Contains', 'wordpoints');
60 60
 	}
61 61
 
62 62
 	/**
@@ -66,13 +66,13 @@  discard block
 block discarded – undo
66 66
 		return array(
67 67
 			'min' => array(
68 68
 				'slug'    => 'min',
69
-				'label'   => __( 'Minimum number of items', 'wordpoints' ),
69
+				'label'   => __('Minimum number of items', 'wordpoints'),
70 70
 				'type'    => 'number',
71 71
 				'default' => 1,
72 72
 			),
73 73
 			'max' => array(
74 74
 				'slug'  => 'max',
75
-				'label' => __( 'Maximum number of items', 'wordpoints' ),
75
+				'label' => __('Maximum number of items', 'wordpoints'),
76 76
 				'type'  => 'number',
77 77
 			),
78 78
 		);
@@ -92,8 +92,8 @@  discard block
 block discarded – undo
92 92
 
93 93
 		$this->validate_count();
94 94
 
95
-		if ( isset( $settings['conditions'] ) ) {
96
-			$this->validate_conditions( $arg );
95
+		if (isset($settings['conditions'])) {
96
+			$this->validate_conditions($arg);
97 97
 		}
98 98
 
99 99
 		return $this->settings;
@@ -107,31 +107,31 @@  discard block
 block discarded – undo
107 107
 	protected function validate_count() {
108 108
 
109 109
 		if (
110
-			! empty( $this->settings['max'] )
111
-			&& ! wordpoints_posint( $this->settings['max'] )
110
+			! empty($this->settings['max'])
111
+			&& ! wordpoints_posint($this->settings['max'])
112 112
 		) {
113 113
 			$this->validator->add_error(
114
-				__( 'The maximum must be a positive integer.', 'wordpoints' )
114
+				__('The maximum must be a positive integer.', 'wordpoints')
115 115
 				, 'max'
116 116
 			);
117 117
 		}
118 118
 
119
-		if ( ! empty( $this->settings['min'] ) ) {
119
+		if ( ! empty($this->settings['min'])) {
120 120
 
121
-			if ( ! wordpoints_posint( $this->settings['min'] ) ) {
121
+			if ( ! wordpoints_posint($this->settings['min'])) {
122 122
 
123 123
 				$this->validator->add_error(
124
-					__( 'The minimum must be a positive integer.', 'wordpoints' )
124
+					__('The minimum must be a positive integer.', 'wordpoints')
125 125
 					, 'min'
126 126
 				);
127 127
 
128 128
 			} elseif (
129
-				! empty( $this->settings['max'] )
129
+				! empty($this->settings['max'])
130 130
 				&& $this->settings['max'] < $this->settings['min']
131 131
 			) {
132 132
 
133 133
 				$this->validator->add_error(
134
-					__( 'The minimum must be less than the maximum.', 'wordpoints' )
134
+					__('The minimum must be less than the maximum.', 'wordpoints')
135 135
 					, 'min'
136 136
 				);
137 137
 			}
@@ -145,24 +145,24 @@  discard block
 block discarded – undo
145 145
 	 *
146 146
 	 * @param WordPoints_EntityishI $current_arg The current arg.
147 147
 	 */
148
-	protected function validate_conditions( $current_arg ) {
148
+	protected function validate_conditions($current_arg) {
149 149
 
150
-		$args = new WordPoints_Hook_Event_Args( array() );
150
+		$args = new WordPoints_Hook_Event_Args(array());
151 151
 
152
-		if ( $current_arg instanceof WordPoints_Entity_Array ) {
152
+		if ($current_arg instanceof WordPoints_Entity_Array) {
153 153
 
154 154
 			$entity = wordpoints_entities()->get(
155 155
 				$current_arg->get_entity_slug()
156 156
 			);
157 157
 
158
-			if ( $entity instanceof WordPoints_Entity ) {
159
-				$args->add_entity( $entity );
158
+			if ($entity instanceof WordPoints_Entity) {
159
+				$args->add_entity($entity);
160 160
 			}
161 161
 		}
162 162
 
163
-		$args->set_validator( $this->validator );
163
+		$args->set_validator($this->validator);
164 164
 
165
-		$this->validator->push_field( 'conditions' );
165
+		$this->validator->push_field('conditions');
166 166
 
167 167
 		$this->settings['conditions'] = $this->conditions_extension->validate_conditions(
168 168
 			$this->settings['conditions']
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
 	/**
176 176
 	 * @since 1.0.0
177 177
 	 */
178
-	public function is_met( array $settings, WordPoints_Hook_Event_Args $args ) {
178
+	public function is_met(array $settings, WordPoints_Hook_Event_Args $args) {
179 179
 
180 180
 		$this->settings = $settings;
181 181
 
@@ -183,16 +183,16 @@  discard block
 block discarded – undo
183 183
 
184 184
 		$entities = array();
185 185
 
186
-		if ( $arg instanceof WordPoints_Entity_Array ) {
186
+		if ($arg instanceof WordPoints_Entity_Array) {
187 187
 
188 188
 			$entities = $arg->get_the_entities();
189 189
 
190
-			if ( isset( $this->settings['conditions'] ) ) {
191
-				$entities = $this->filter_entities( $entities );
190
+			if (isset($this->settings['conditions'])) {
191
+				$entities = $this->filter_entities($entities);
192 192
 			}
193 193
 		}
194 194
 
195
-		return $this->check_count( count( $entities ) );
195
+		return $this->check_count(count($entities));
196 196
 	}
197 197
 
198 198
 	/**
@@ -204,20 +204,20 @@  discard block
 block discarded – undo
204 204
 	 *
205 205
 	 * @return WordPoints_Entity[] The entities that matched the sub-conditions.
206 206
 	 */
207
-	protected function filter_entities( $entities ) {
207
+	protected function filter_entities($entities) {
208 208
 
209
-		foreach ( $entities as $index => $entity ) {
209
+		foreach ($entities as $index => $entity) {
210 210
 
211
-			$event_args = new WordPoints_Hook_Event_Args( array() );
212
-			$event_args->add_entity( $entity );
211
+			$event_args = new WordPoints_Hook_Event_Args(array());
212
+			$event_args->add_entity($entity);
213 213
 
214 214
 			$matches = $this->conditions_extension->conditions_are_met(
215 215
 				$this->settings['conditions']
216 216
 				, $event_args
217 217
 			);
218 218
 
219
-			if ( ! $matches ) {
220
-				unset( $entities[ $index ] );
219
+			if ( ! $matches) {
220
+				unset($entities[$index]);
221 221
 			}
222 222
 		}
223 223
 
@@ -233,13 +233,13 @@  discard block
 block discarded – undo
233 233
 	 *
234 234
 	 * @return bool Whether the count met the requirements.
235 235
 	 */
236
-	protected function check_count( $count ) {
236
+	protected function check_count($count) {
237 237
 
238
-		if ( isset( $this->settings['max'] ) && $count > $this->settings['max'] ) {
238
+		if (isset($this->settings['max']) && $count > $this->settings['max']) {
239 239
 			return false;
240 240
 		}
241 241
 
242
-		if ( isset( $this->settings['min'] ) && $count < $this->settings['min'] ) {
242
+		if (isset($this->settings['min']) && $count < $this->settings['min']) {
243 243
 			return false;
244 244
 		}
245 245
 
Please login to merge, or discard this patch.
src/includes/classes/hook/events.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -35,13 +35,13 @@  discard block
 block discarded – undo
35 35
 	/**
36 36
 	 * @since 1.0.0
37 37
 	 */
38
-	public function __construct( $slug ) {
38
+	public function __construct($slug) {
39 39
 
40 40
 		$hooks = wordpoints_hooks();
41 41
 
42
-		$this->router = $hooks->get_sub_app( 'router' );
42
+		$this->router = $hooks->get_sub_app('router');
43 43
 
44
-		parent::__construct( $slug );
44
+		parent::__construct($slug);
45 45
 	}
46 46
 
47 47
 	/**
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 	 */
50 50
 	public function init() {
51 51
 
52
-		$this->sub_apps()->register( 'args', 'WordPoints_Class_Registry_Children' );
52
+		$this->sub_apps()->register('args', 'WordPoints_Class_Registry_Children');
53 53
 
54 54
 		parent::init();
55 55
 	}
@@ -73,27 +73,27 @@  discard block
 block discarded – undo
73 73
 	 *
74 74
 	 * @return bool Whether the event was registered.
75 75
 	 */
76
-	public function register( $slug, $class, array $args = array() ) {
76
+	public function register($slug, $class, array $args = array()) {
77 77
 
78
-		parent::register( $slug, $class, $args );
78
+		parent::register($slug, $class, $args);
79 79
 
80
-		if ( isset( $args['actions'] ) ) {
81
-			foreach ( $args['actions'] as $type => $actions ) {
82
-				foreach ( (array) $actions as $action_slug ) {
83
-					$this->router->add_event_to_action( $slug, $action_slug, $type );
80
+		if (isset($args['actions'])) {
81
+			foreach ($args['actions'] as $type => $actions) {
82
+				foreach ((array) $actions as $action_slug) {
83
+					$this->router->add_event_to_action($slug, $action_slug, $type);
84 84
 				}
85 85
 			}
86 86
 		}
87 87
 
88
-		if ( isset( $args['args'] ) ) {
89
-			$args_registry = $this->get_sub_app( 'args' );
88
+		if (isset($args['args'])) {
89
+			$args_registry = $this->get_sub_app('args');
90 90
 
91
-			foreach ( $args['args'] as $arg_slug => $class ) {
92
-				$args_registry->register( $slug, $arg_slug, $class );
91
+			foreach ($args['args'] as $arg_slug => $class) {
92
+				$args_registry->register($slug, $arg_slug, $class);
93 93
 			}
94 94
 		}
95 95
 
96
-		$this->event_data[ $slug ] = $args;
96
+		$this->event_data[$slug] = $args;
97 97
 
98 98
 		return true;
99 99
 	}
@@ -101,23 +101,23 @@  discard block
 block discarded – undo
101 101
 	/**
102 102
 	 * @since 1.0.0
103 103
 	 */
104
-	public function deregister( $slug ) {
104
+	public function deregister($slug) {
105 105
 
106
-		if ( ! $this->is_registered( $slug ) ) {
106
+		if ( ! $this->is_registered($slug)) {
107 107
 			return;
108 108
 		}
109 109
 
110
-		parent::deregister( $slug );
110
+		parent::deregister($slug);
111 111
 
112
-		foreach ( (array) $this->event_data[ $slug ]['actions'] as $type => $actions ) {
113
-			foreach ( (array) $actions as $action_slug ) {
114
-				$this->router->remove_event_from_action( $slug, $action_slug, $type );
112
+		foreach ((array) $this->event_data[$slug]['actions'] as $type => $actions) {
113
+			foreach ((array) $actions as $action_slug) {
114
+				$this->router->remove_event_from_action($slug, $action_slug, $type);
115 115
 			}
116 116
 		}
117 117
 
118
-		$this->get_sub_app( 'args' )->deregister_children( $slug );
118
+		$this->get_sub_app('args')->deregister_children($slug);
119 119
 
120
-		unset( $this->event_data[ $slug ] );
120
+		unset($this->event_data[$slug]);
121 121
 	}
122 122
 }
123 123
 
Please login to merge, or discard this patch.
src/includes/classes/entity.php 1 patch
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -106,11 +106,11 @@  discard block
 block discarded – undo
106 106
 	 *
107 107
 	 * @return mixed The entity, or false if not found.
108 108
 	 */
109
-	protected function get_entity( $id ) {
109
+	protected function get_entity($id) {
110 110
 
111
-		$entity = call_user_func( $this->getter, $id );
111
+		$entity = call_user_func($this->getter, $id);
112 112
 
113
-		if ( ! $this->is_entity( $entity ) ) {
113
+		if ( ! $this->is_entity($entity)) {
114 114
 			return false;
115 115
 		}
116 116
 
@@ -126,13 +126,13 @@  discard block
 block discarded – undo
126 126
 	 *
127 127
 	 * @return bool Whether the passed value is an entity.
128 128
 	 */
129
-	protected function is_entity( $entity ) {
129
+	protected function is_entity($entity) {
130 130
 
131
-		if ( ! is_object( $entity ) && ! is_array( $entity ) ) {
131
+		if ( ! is_object($entity) && ! is_array($entity)) {
132 132
 			return false;
133 133
 		}
134 134
 
135
-		return (bool) $this->get_entity_id( $entity );
135
+		return (bool) $this->get_entity_id($entity);
136 136
 	}
137 137
 
138 138
 	/**
@@ -145,14 +145,14 @@  discard block
 block discarded – undo
145 145
 	 *
146 146
 	 * @return mixed The value of the attribute of the entity.
147 147
 	 */
148
-	protected function get_attr_value( $entity, $attr ) {
148
+	protected function get_attr_value($entity, $attr) {
149 149
 
150
-		if ( is_array( $entity ) ) {
151
-			if ( isset( $entity[ $attr ] ) ) {
152
-				return $entity[ $attr ];
150
+		if (is_array($entity)) {
151
+			if (isset($entity[$attr])) {
152
+				return $entity[$attr];
153 153
 			}
154 154
 		} else {
155
-			if ( isset( $entity->{$attr} ) ) {
155
+			if (isset($entity->{$attr} )) {
156 156
 				return $entity->{$attr};
157 157
 			}
158 158
 		}
@@ -169,8 +169,8 @@  discard block
 block discarded – undo
169 169
 	 *
170 170
 	 * @return mixed The ID of the entity.
171 171
 	 */
172
-	protected function get_entity_id( $entity ) {
173
-		return $this->get_attr_value( $entity, $this->get_id_field() );
172
+	protected function get_entity_id($entity) {
173
+		return $this->get_attr_value($entity, $this->get_id_field());
174 174
 	}
175 175
 
176 176
 	/**
@@ -186,8 +186,8 @@  discard block
 block discarded – undo
186 186
 	 *
187 187
 	 * @return mixed The human ID of the entity.
188 188
 	 */
189
-	protected function get_entity_human_id( $entity ) {
190
-		return $this->get_attr_value( $entity, $this->human_id_field );
189
+	protected function get_entity_human_id($entity) {
190
+		return $this->get_attr_value($entity, $this->human_id_field);
191 191
 	}
192 192
 
193 193
 	//
@@ -229,15 +229,15 @@  discard block
 block discarded – undo
229 229
 	 *
230 230
 	 * @return string|int|float|false The human identifier for the entity, or false.
231 231
 	 */
232
-	public function get_human_id( $id ) {
232
+	public function get_human_id($id) {
233 233
 
234
-		$entity = $this->get_entity( $id );
234
+		$entity = $this->get_entity($id);
235 235
 
236
-		if ( ! $entity ) {
236
+		if ( ! $entity) {
237 237
 			return false;
238 238
 		}
239 239
 
240
-		return $this->get_entity_human_id( $entity );
240
+		return $this->get_entity_human_id($entity);
241 241
 	}
242 242
 
243 243
 	/**
@@ -249,8 +249,8 @@  discard block
 block discarded – undo
249 249
 	 *
250 250
 	 * @return bool Whether or not an entity with that ID exists.
251 251
 	 */
252
-	public function exists( $id ) {
253
-		return (bool) $this->get_entity( $id );
252
+	public function exists($id) {
253
+		return (bool) $this->get_entity($id);
254 254
 	}
255 255
 
256 256
 	/**
@@ -265,17 +265,17 @@  discard block
 block discarded – undo
265 265
 	 *
266 266
 	 * @return WordPoints_Entityish|false The child's object, or false if not found.
267 267
 	 */
268
-	public function get_child( $child_slug ) {
268
+	public function get_child($child_slug) {
269 269
 
270
-		$children = wordpoints_entities()->get_sub_app( 'children' );
270
+		$children = wordpoints_entities()->get_sub_app('children');
271 271
 
272
-		$child = $children->get( $this->slug, $child_slug );
272
+		$child = $children->get($this->slug, $child_slug);
273 273
 
274 274
 		if (
275
-			isset( $this->the_value )
275
+			isset($this->the_value)
276 276
 			&& $child instanceof WordPoints_Entity_ChildI
277 277
 		) {
278
-			$child->set_the_value_from_entity( $this );
278
+			$child->set_the_value_from_entity($this);
279 279
 		}
280 280
 
281 281
 		return $child;
@@ -297,20 +297,20 @@  discard block
 block discarded – undo
297 297
 	 *
298 298
 	 * @return bool Whether the value was set.
299 299
 	 */
300
-	public function set_the_value( $value ) {
300
+	public function set_the_value($value) {
301 301
 
302 302
 		$this->the_value = $this->the_entity = $this->the_context = null;
303 303
 
304
-		if ( $this->is_entity( $value ) ) {
304
+		if ($this->is_entity($value)) {
305 305
 
306 306
 			$entity = $value;
307
-			$value = $this->get_entity_id( $value );
307
+			$value = $this->get_entity_id($value);
308 308
 
309 309
 		} else {
310 310
 
311
-			$entity = $this->get_entity( $value );
311
+			$entity = $this->get_entity($value);
312 312
 
313
-			if ( ! $entity ) {
313
+			if ( ! $entity) {
314 314
 				return false;
315 315
 			}
316 316
 		}
@@ -333,8 +333,8 @@  discard block
 block discarded – undo
333 333
 	 *
334 334
 	 * @return mixed The value of the attribute.
335 335
 	 */
336
-	public function get_the_attr_value( $attr ) {
337
-		return $this->get_attr_value( $this->the_entity, $attr );
336
+	public function get_the_attr_value($attr) {
337
+		return $this->get_attr_value($this->the_entity, $attr);
338 338
 	}
339 339
 
340 340
 	/**
@@ -358,7 +358,7 @@  discard block
 block discarded – undo
358 358
 	 * @return string|int|float|null The human identifier for the entity, or null.
359 359
 	 */
360 360
 	public function get_the_human_id() {
361
-		return $this->get_entity_human_id( $this->the_entity );
361
+		return $this->get_entity_human_id($this->the_entity);
362 362
 	}
363 363
 
364 364
 	/**
@@ -392,11 +392,11 @@  discard block
 block discarded – undo
392 392
 
393 393
 		$guid = $this->get_the_context();
394 394
 
395
-		if ( ! is_array( $guid ) ) {
395
+		if ( ! is_array($guid)) {
396 396
 			return $guid;
397 397
 		}
398 398
 
399
-		$guid = array( $this->slug => $this->get_the_id() ) + $guid;
399
+		$guid = array($this->slug => $this->get_the_id()) + $guid;
400 400
 
401 401
 		return $guid;
402 402
 	}
Please login to merge, or discard this patch.
src/includes/classes/hook/action/comment/new.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -18,18 +18,18 @@
 block discarded – undo
18 18
 	/**
19 19
 	 * @since 1.0.0
20 20
 	 */
21
-	protected $post_hierarchy = array( 'comment\\post', 'post\\post', 'post\\post' );
21
+	protected $post_hierarchy = array('comment\\post', 'post\\post', 'post\\post');
22 22
 
23 23
 	/**
24 24
 	 * @since 1.0.0
25 25
 	 */
26 26
 	public function should_fire() {
27 27
 
28
-		if ( ! isset( $this->args[1]->comment_approved ) ) {
28
+		if ( ! isset($this->args[1]->comment_approved)) {
29 29
 			return false;
30 30
 		}
31 31
 
32
-		if ( 1 !== (int) $this->args[1]->comment_approved ) {
32
+		if (1 !== (int) $this->args[1]->comment_approved) {
33 33
 			return false;
34 34
 		}
35 35
 
Please login to merge, or discard this patch.
src/includes/classes/hook/action/post/depublish/delete.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -21,11 +21,11 @@
 block discarded – undo
21 21
 
22 22
 		$post = $this->get_post_entity();
23 23
 
24
-		if ( ! $post ) {
24
+		if ( ! $post) {
25 25
 			return false;
26 26
 		}
27 27
 
28
-		if ( 'publish' !== get_post_status( $post->get_the_id() ) ) {
28
+		if ('publish' !== get_post_status($post->get_the_id())) {
29 29
 			return false;
30 30
 		}
31 31
 
Please login to merge, or discard this patch.
src/includes/classes/hook/action/post/type/comment.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 block discarded – undo
18 18
 	/**
19 19
 	 * @since 1.0.0
20 20
 	 */
21
-	protected $post_hierarchy = array( 'comment\\post', 'post\\post', 'post\\post' );
21
+	protected $post_hierarchy = array('comment\\post', 'post\\post', 'post\\post');
22 22
 }
23 23
 
24 24
 // EOF
Please login to merge, or discard this patch.
src/includes/classes/hook/action/post/type.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 	 *
22 22
 	 * @var string[]
23 23
 	 */
24
-	protected $post_hierarchy = array( 'post\\post' );
24
+	protected $post_hierarchy = array('post\\post');
25 25
 
26 26
 	/**
27 27
 	 * @since 1.0.0
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 
31 31
 		$post = $this->get_post_entity();
32 32
 
33
-		if ( ! $post ) {
33
+		if ( ! $post) {
34 34
 			return false;
35 35
 		}
36 36
 
@@ -48,42 +48,42 @@  discard block
 block discarded – undo
48 48
 	 */
49 49
 	protected function get_post_entity() {
50 50
 
51
-		$parts = wordpoints_parse_dynamic_slug( $this->slug );
51
+		$parts = wordpoints_parse_dynamic_slug($this->slug);
52 52
 
53
-		if ( ! $parts['dynamic'] ) {
53
+		if ( ! $parts['dynamic']) {
54 54
 			return false;
55 55
 		}
56 56
 
57 57
 		$this->post_hierarchy = str_replace(
58 58
 			'\\post'
59
-			, '\\' . $parts['dynamic']
59
+			, '\\'.$parts['dynamic']
60 60
 			, $this->post_hierarchy
61 61
 		);
62 62
 
63
-		$entity = wordpoints_entities()->get( $this->post_hierarchy[0] );
63
+		$entity = wordpoints_entities()->get($this->post_hierarchy[0]);
64 64
 
65
-		if ( ! $entity instanceof WordPoints_Entity ) {
65
+		if ( ! $entity instanceof WordPoints_Entity) {
66 66
 			return false;
67 67
 		}
68 68
 
69
-		$entity->set_the_value( $this->get_arg_value( $this->post_hierarchy[0] ) );
69
+		$entity->set_the_value($this->get_arg_value($this->post_hierarchy[0]));
70 70
 
71
-		if ( 1 === count( $this->post_hierarchy ) ) {
71
+		if (1 === count($this->post_hierarchy)) {
72 72
 
73 73
 			$post_entity = $entity;
74 74
 
75 75
 		} else {
76 76
 
77
-			$args = new WordPoints_Entity_Hierarchy( $entity );
77
+			$args = new WordPoints_Entity_Hierarchy($entity);
78 78
 
79
-			$post_entity = $args->get_from_hierarchy( $this->post_hierarchy );
79
+			$post_entity = $args->get_from_hierarchy($this->post_hierarchy);
80 80
 
81
-			if ( ! $post_entity instanceof WordPoints_Entity ) {
81
+			if ( ! $post_entity instanceof WordPoints_Entity) {
82 82
 				return false;
83 83
 			}
84 84
 		}
85 85
 
86
-		if ( $parts['dynamic'] !== $post_entity->get_the_attr_value( 'post_type' ) ) {
86
+		if ($parts['dynamic'] !== $post_entity->get_the_attr_value('post_type')) {
87 87
 			return false;
88 88
 		}
89 89
 
Please login to merge, or discard this patch.
src/includes/class-un-installer.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 	/**
62 62
 	 * @since 1.0.0
63 63
 	 */
64
-	public function install( $network ) {
64
+	public function install($network) {
65 65
 
66 66
 		// The autoloader won't automatically be initialized because it is usually
67 67
 		// hooked to the modules loaded action, which will have already fired before
@@ -71,16 +71,16 @@  discard block
 block discarded – undo
71 71
 		// Default to network mode off during the install, but save the current
72 72
 		// mode so we can restore it afterward.
73 73
 		$points_hooks_network_mode = WordPoints_Points_Hooks::get_network_mode();
74
-		WordPoints_Points_Hooks::set_network_mode( false );
74
+		WordPoints_Points_Hooks::set_network_mode(false);
75 75
 
76 76
 		$hooks = wordpoints_hooks();
77 77
 		$hooks_mode = $hooks->get_current_mode();
78
-		$hooks->set_current_mode( 'standard' );
78
+		$hooks->set_current_mode('standard');
79 79
 
80
-		parent::install( $network );
80
+		parent::install($network);
81 81
 
82
-		$hooks->set_current_mode( $hooks_mode );
83
-		WordPoints_Points_Hooks::set_network_mode( $points_hooks_network_mode );
82
+		$hooks->set_current_mode($hooks_mode);
83
+		WordPoints_Points_Hooks::set_network_mode($points_hooks_network_mode);
84 84
 	}
85 85
 
86 86
 	/**
@@ -90,13 +90,13 @@  discard block
 block discarded – undo
90 90
 
91 91
 		parent::install_network();
92 92
 
93
-		WordPoints_Points_Hooks::set_network_mode( true );
94
-		wordpoints_hooks()->set_current_mode( 'network' );
93
+		WordPoints_Points_Hooks::set_network_mode(true);
94
+		wordpoints_hooks()->set_current_mode('network');
95 95
 
96 96
 		$this->import_legacy_points_hooks();
97 97
 
98
-		WordPoints_Points_Hooks::set_network_mode( false );
99
-		wordpoints_hooks()->set_current_mode( 'standard' );
98
+		WordPoints_Points_Hooks::set_network_mode(false);
99
+		wordpoints_hooks()->set_current_mode('standard');
100 100
 	}
101 101
 
102 102
 	/**
@@ -129,9 +129,9 @@  discard block
 block discarded – undo
129 129
 		$this->import_legacy_points_hook(
130 130
 			'registration',
131 131
 			'user_register',
132
-			array( 'points' => true ),
132
+			array('points' => true),
133 133
 			'register',
134
-			array( 'user' )
134
+			array('user')
135 135
 		);
136 136
 
137 137
 		$this->import_legacy_points_hook(
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
 				'auto_reverse' => true,
144 144
 			),
145 145
 			'post_publish',
146
-			array( 'post\post', 'author', 'user' )
146
+			array('post\post', 'author', 'user')
147 147
 		);
148 148
 
149 149
 		$this->import_legacy_points_hook(
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
 				'auto_reverse' => true,
156 156
 			),
157 157
 			'comment_approve',
158
-			array( 'comment\post', 'author', 'user' )
158
+			array('comment\post', 'author', 'user')
159 159
 		);
160 160
 
161 161
 		$this->import_legacy_points_hook(
@@ -167,15 +167,15 @@  discard block
 block discarded – undo
167 167
 				'auto_reverse' => true,
168 168
 			),
169 169
 			'comment_received',
170
-			array( 'comment\post', 'post\post', 'post\post', 'author', 'user' )
170
+			array('comment\post', 'post\post', 'post\post', 'author', 'user')
171 171
 		);
172 172
 
173 173
 		$this->import_legacy_points_hook(
174 174
 			'periodic',
175 175
 			'user_visit',
176
-			array( 'points' => true, 'period' => true ),
176
+			array('points' => true, 'period' => true),
177 177
 			'periodic',
178
-			array( 'current:user' )
178
+			array('current:user')
179 179
 		);
180 180
 	}
181 181
 
Please login to merge, or discard this patch.