Completed
Push — master ( 5b2818...3f335f )
by J.D.
03:35
created
src/includes/classes/entity/attr/field.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -37,8 +37,8 @@
 block discarded – undo
37 37
 	/**
38 38
 	 * @since 1.0.0
39 39
 	 */
40
-	protected function get_attr_value_from_entity( WordPoints_Entity $entity ) {
41
-		return $entity->get_the_attr_value( $this->field );
40
+	protected function get_attr_value_from_entity(WordPoints_Entity $entity) {
41
+		return $entity->get_the_attr_value($this->field);
42 42
 	}
43 43
 	
44 44
 	/**
Please login to merge, or discard this patch.
src/includes/classes/entity/stored/array.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@
 block discarded – undo
31 31
 	public function get_storage_info() {
32 32
 		return array(
33 33
 			'type' => 'array',
34
-			'info' => array( 'type' => 'method' ),
34
+			'info' => array('type' => 'method'),
35 35
 		);
36 36
 	}
37 37
 }
Please login to merge, or discard this patch.
src/includes/classes/entity/relationship/stored/field.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -37,8 +37,8 @@
 block discarded – undo
37 37
 	/**
38 38
 	 * @since 1.0.0
39 39
 	 */
40
-	protected function get_related_entity_ids( WordPoints_Entity $entity ) {
41
-		return $entity->get_the_attr_value( $this->related_ids_field );
40
+	protected function get_related_entity_ids(WordPoints_Entity $entity) {
41
+		return $entity->get_the_attr_value($this->related_ids_field);
42 42
 	}
43 43
 	
44 44
 	/**
Please login to merge, or discard this patch.
src/includes/classes/entity/attr.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 	 *
40 40
 	 * @return mixed The attribute value.
41 41
 	 */
42
-	abstract protected function get_attr_value_from_entity( WordPoints_Entity $entity );
42
+	abstract protected function get_attr_value_from_entity(WordPoints_Entity $entity);
43 43
 
44 44
 	/**
45 45
 	 * Get the data type of this attribute's values.
@@ -66,9 +66,9 @@  discard block
 block discarded – undo
66 66
 	 *
67 67
 	 * @return bool Whether the value was set correctly.
68 68
 	 */
69
-	public function set_the_value_from_entity( WordPoints_Entity $entity ) {
69
+	public function set_the_value_from_entity(WordPoints_Entity $entity) {
70 70
 
71
-		$this->the_value = $this->get_attr_value_from_entity( $entity );
71
+		$this->the_value = $this->get_attr_value_from_entity($entity);
72 72
 
73 73
 		return true;
74 74
 	}
Please login to merge, or discard this patch.
src/includes/classes/entity/user/roles.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -34,15 +34,15 @@  discard block
 block discarded – undo
34 34
 	/**
35 35
 	 * @since 1.0.0
36 36
 	 */
37
-	protected function get_related_entity_ids( WordPoints_Entity $entity ) {
38
-		return $entity->get_the_attr_value( $this->related_ids_field );
37
+	protected function get_related_entity_ids(WordPoints_Entity $entity) {
38
+		return $entity->get_the_attr_value($this->related_ids_field);
39 39
 	}
40 40
 
41 41
 	/**
42 42
 	 * @since 1.0.0
43 43
 	 */
44 44
 	public function get_title() {
45
-		return __( 'Roles', 'wordpoints' );
45
+		return __('Roles', 'wordpoints');
46 46
 	}
47 47
 
48 48
 	/**
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 				'conditions'       => array(
63 63
 					array(
64 64
 						'field' => 'meta_key',
65
-						'value' => $GLOBALS['wpdb']->get_blog_prefix() . 'capabilities',
65
+						'value' => $GLOBALS['wpdb']->get_blog_prefix().'capabilities',
66 66
 					),
67 67
 				),
68 68
 			),
Please login to merge, or discard this patch.
src/includes/classes/entity/comment/post.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -37,8 +37,8 @@
 block discarded – undo
37 37
 	/**
38 38
 	 * @since 1.0.0
39 39
 	 */
40
-	protected function get_related_entity_ids( WordPoints_Entity $entity ) {
41
-		return $entity->get_the_attr_value( $this->related_ids_field );
40
+	protected function get_related_entity_ids(WordPoints_Entity $entity) {
41
+		return $entity->get_the_attr_value($this->related_ids_field);
42 42
 	}
43 43
 	
44 44
 	/**
Please login to merge, or discard this patch.
src/includes/classes/entity/change.php 2 patches
Doc Comments   +15 added lines patch added patch discarded remove patch
@@ -58,8 +58,20 @@  discard block
 block discarded – undo
58 58
 
59 59
 // this is basically a reactor
60 60
 interface WordPoints_Entity_Change_ListenerI {
61
+
62
+	/**
63
+	 * @return void
64
+	 */
61 65
 	public function created( WordPoints_Entity $entity );
66
+
67
+	/**
68
+	 * @return void
69
+	 */
62 70
 	public function updated( WordPoints_Entity $before, WordPoints_Entity $after );
71
+
72
+	/**
73
+	 * @return void
74
+	 */
63 75
 	public function deleted( WordPoints_Entity $entity );
64 76
 }
65 77
 
@@ -129,6 +141,9 @@  discard block
 block discarded – undo
129 141
 		return true;
130 142
 	}
131 143
 
144
+	/**
145
+	 * @param string $type
146
+	 */
132 147
 	protected function fire_event( $type, WordPoints_Entity $entity ) {
133 148
 
134 149
 		$args = new WordPoints_Hook_Event_Args( array() );
Please login to merge, or discard this patch.
Spacing   +63 added lines, -63 removed lines patch added patch discarded remove patch
@@ -10,19 +10,19 @@  discard block
 block discarded – undo
10 10
 // this is basicaly a router.
11 11
 class WordPoints_Entity_chang_trigger implements WordPoints_Entity_Change_ListenerI {
12 12
 
13
-	public function created( WordPoints_Entity $entity ) {
13
+	public function created(WordPoints_Entity $entity) {
14 14
 		// can multiple entities be created at once? not using insert() but via query()
15 15
 		// maybe? and how shoudl we handle that, all at once or one by one?
16 16
 
17 17
 		/** @var WordPoints_Entity_Change_ListenerI[] $listeners */
18
-		$listeners = wordpoints_apps()->get_sub_app( 'entity_change_listeners' );
19
-		foreach ( $listeners as $listener ) {
20
-			$listener->created( $entity );
18
+		$listeners = wordpoints_apps()->get_sub_app('entity_change_listeners');
19
+		foreach ($listeners as $listener) {
20
+			$listener->created($entity);
21 21
 		}
22 22
 	}
23 23
 
24 24
 
25
-	public function updated( WordPoints_Entity $before, WordPoints_Entity $after ) {
25
+	public function updated(WordPoints_Entity $before, WordPoints_Entity $after) {
26 26
 
27 27
 		// what if multiple entities are updated at once? do we run each one separatately?
28 28
 		// mayb ethat should be left up to the listenter.
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 	}
31 31
 
32 32
 
33
-	public function deleted( WordPoints_Entity $entity ) {
33
+	public function deleted(WordPoints_Entity $entity) {
34 34
 
35 35
 		// what if we need information about this entitie's relationships, etc., that
36 36
 		// isn't included inthe entity object?
@@ -58,41 +58,41 @@  discard block
 block discarded – undo
58 58
 
59 59
 // this is basically a reactor
60 60
 interface WordPoints_Entity_Change_ListenerI {
61
-	public function created( WordPoints_Entity $entity );
62
-	public function updated( WordPoints_Entity $before, WordPoints_Entity $after );
63
-	public function deleted( WordPoints_Entity $entity );
61
+	public function created(WordPoints_Entity $entity);
62
+	public function updated(WordPoints_Entity $before, WordPoints_Entity $after);
63
+	public function deleted(WordPoints_Entity $entity);
64 64
 }
65 65
 
66 66
 class WordPoints_Entity_Change_Listener_Hooks implements WordPoints_Entity_Change_ListenerI {
67 67
 
68
-	public function created( WordPoints_Entity $entity ) {
68
+	public function created(WordPoints_Entity $entity) {
69 69
 
70 70
 		// maybe we would have multuiple events with requirements for a single entity?
71 71
 		// like comment author and post commentn author targets for the same hook.
72 72
 		// but I guess taht is just one event.
73 73
 		// what about user register vs user create on MS?
74
-		if ( $this->matches_requirements( $entity ) ) {
75
-			$this->fire_event( 'add', $entity );
74
+		if ($this->matches_requirements($entity)) {
75
+			$this->fire_event('add', $entity);
76 76
 		}
77 77
 	}
78 78
 
79
-	public function updated( WordPoints_Entity $before, WordPoints_Entity $after ) {
79
+	public function updated(WordPoints_Entity $before, WordPoints_Entity $after) {
80 80
 
81
-		if ( $this->matches_requirements( $after ) ) {
82
-			if ( ! $this->matches_requirements( $before ) ) {
83
-				$this->fire_event( 'add', $after );
81
+		if ($this->matches_requirements($after)) {
82
+			if ( ! $this->matches_requirements($before)) {
83
+				$this->fire_event('add', $after);
84 84
 			}
85 85
 		} else {
86
-			if ( $this->matches_requirements( $before ) ) {
87
-				$this->fire_event( 'remove', $after );
86
+			if ($this->matches_requirements($before)) {
87
+				$this->fire_event('remove', $after);
88 88
 			}
89 89
 		}
90 90
 	}
91 91
 
92
-	public function deleted( WordPoints_Entity $entity ) {
92
+	public function deleted(WordPoints_Entity $entity) {
93 93
 
94
-		if ( $this->matches_requirements( $entity ) ) {
95
-			$this->fire_event( 'remove', $entity );
94
+		if ($this->matches_requirements($entity)) {
95
+			$this->fire_event('remove', $entity);
96 96
 		}
97 97
 	}
98 98
 
@@ -108,20 +108,20 @@  discard block
 block discarded – undo
108 108
 	// called into play when the entity itself is deleted is moot, because the
109 109
 	// reltionships, etc., aren't even taken into account when toggle-off is called,
110 110
 	// in the points reactor. other reators might, i guess.
111
-	protected function matches_requirements( WordPoints_Entity $entity ) {
111
+	protected function matches_requirements(WordPoints_Entity $entity) {
112 112
 
113 113
 		/** @var WordPoints_Class_Registry $defaults */
114
-		$defaults = wordpoints_apps()->get_sub_app( 'entity_possession_defaults' );
114
+		$defaults = wordpoints_apps()->get_sub_app('entity_possession_defaults');
115 115
 
116
-		$defaults = $defaults->get( $entity->get_slug() );
116
+		$defaults = $defaults->get($entity->get_slug());
117 117
 
118
-		if ( ! $defaults ) {
118
+		if ( ! $defaults) {
119 119
 			return false;
120 120
 		}
121 121
 
122 122
 		// use conditions here?
123
-		foreach ( $defaults as $child => $value ) {
124
-			if ( $entity->get_child( $child ) !== $value ) {
123
+		foreach ($defaults as $child => $value) {
124
+			if ($entity->get_child($child) !== $value) {
125 125
 				return false;
126 126
 			}
127 127
 		}
@@ -129,13 +129,13 @@  discard block
 block discarded – undo
129 129
 		return true;
130 130
 	}
131 131
 
132
-	protected function fire_event( $type, WordPoints_Entity $entity ) {
132
+	protected function fire_event($type, WordPoints_Entity $entity) {
133 133
 
134
-		$args = new WordPoints_Hook_Event_Args( array() );
135
-		$args->add_entity( $entity );
134
+		$args = new WordPoints_Hook_Event_Args(array());
135
+		$args->add_entity($entity);
136 136
 
137 137
 		wordpoints_hooks()->fire(
138
-			$type . '_entity_' . $entity->get_slug(),
138
+			$type.'_entity_'.$entity->get_slug(),
139 139
 			$args,
140 140
 			'toggle_on'
141 141
 		);
@@ -144,31 +144,31 @@  discard block
 block discarded – undo
144 144
 
145 145
 class WordPoints_Entity_Change_Listener_Points implements WordPoints_Entity_Change_ListenerI {
146 146
 
147
-	public function created( WordPoints_Entity $entity ) {
147
+	public function created(WordPoints_Entity $entity) {
148 148
 
149 149
 		$this->process_entityish(
150 150
 			$entity
151
-			, $this->get_settings_for_entity( $entity )
151
+			, $this->get_settings_for_entity($entity)
152 152
 		);
153 153
 	}
154 154
 
155
-	protected function process_entityish( WordPoints_EntityishI $entity, $settings ) {
155
+	protected function process_entityish(WordPoints_EntityishI $entity, $settings) {
156 156
 
157 157
 		// possibly make this more like extension handling
158
-		if ( ! $this->meets_conditions( $entity, $settings['conditions'] ) ) {
158
+		if ( ! $this->meets_conditions($entity, $settings['conditions'])) {
159 159
 			return;
160 160
 		}
161 161
 
162 162
 		// possibly make this more like reactor handling.
163
-		$this->award_points( $settings );
163
+		$this->award_points($settings);
164 164
 
165 165
 		// only proces the attributes taht have changed.
166 166
 		// acutally, in this case, the entity was just created.
167
-		if ( $entity instanceof WordPoints_Entity_ParentI ) {
167
+		if ($entity instanceof WordPoints_Entity_ParentI) {
168 168
 
169 169
 			// this check runs on attributes only.
170
-			foreach ( $settings['children'] as $child_slug => $child_settings ) {
171
-				$this->process_entityish( $entity->get_child( $child_slug ), $child_settings );
170
+			foreach ($settings['children'] as $child_slug => $child_settings) {
171
+				$this->process_entityish($entity->get_child($child_slug), $child_settings);
172 172
 			}
173 173
 
174 174
 			// we also need to check for any children, like relationships, that have
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
 			// for this we need a list of relationships.
177 177
 			// if we do two-way relationships, we may need to have infinite-loop
178 178
 			// halding here, depending.
179
-			foreach ( $this->get_related_entities( $entity ) as $child_entity ) {
179
+			foreach ($this->get_related_entities($entity) as $child_entity) {
180 180
 				// If a comment was just created, for example, and we have conditions
181 181
 				// on the post entity, that affect the comment author, this allows
182 182
 				// us to handle those by pulling up the settings for the post entity
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
 				// as we've proposed...
196 196
 				$this->process_entityish(
197 197
 					$child_entity
198
-					, $this->get_entity_settings( $child_entity )
198
+					, $this->get_entity_settings($child_entity)
199 199
 				);
200 200
 			}
201 201
 		}
@@ -209,15 +209,15 @@  discard block
 block discarded – undo
209 209
 	// doesn't really make sense.
210 210
 	// I think relationships can be created and deleted, but not really updated.
211 211
 	// so maybe what we need is a separate api?
212
-	public function updated( WordPoints_Entity $before, WordPoints_Entity $after ) {
212
+	public function updated(WordPoints_Entity $before, WordPoints_Entity $after) {
213 213
 
214
-		$settings = $this->get_settings_for_entity( $before );
214
+		$settings = $this->get_settings_for_entity($before);
215 215
 
216 216
 		/** @var WordPoints_Class_Registry_ChildrenI $children */
217
-		$children = wordpoints_entities()->get_sub_app( 'children' );
218
-		foreach ( $children->get_children_slugs( $before->get_slug() ) as $child_slug ) {
217
+		$children = wordpoints_entities()->get_sub_app('children');
218
+		foreach ($children->get_children_slugs($before->get_slug()) as $child_slug) {
219 219
 			
220
-			if ( ! isset( $settings['children'][ $child_slug ] ) ) {
220
+			if ( ! isset($settings['children'][$child_slug])) {
221 221
 				continue;
222 222
 			}
223 223
 			
@@ -232,23 +232,23 @@  discard block
 block discarded – undo
232 232
 			// but then we'll not be checking even the relationships taht are defined
233 233
 			// on the atts. so we have to decide whether those should be handled by
234 234
 			// a separate api or not.
235
-			if ( $before->get_the_attr_value( $child_slug ) === $after->get_the_attr_value( $child_slug ) ) {
235
+			if ($before->get_the_attr_value($child_slug) === $after->get_the_attr_value($child_slug)) {
236 236
 				continue;
237 237
 			}
238 238
 
239 239
 			$this->process_modified_entityish(
240
-				$before->get_child( $child_slug )
241
-				, $after->get_child( $child_slug )
242
-				, $settings['children'][ $child_slug ]
240
+				$before->get_child($child_slug)
241
+				, $after->get_child($child_slug)
242
+				, $settings['children'][$child_slug]
243 243
 			);
244 244
 		}
245 245
 	}
246 246
 
247
-	protected function process_modified_entityish( WordPoints_EntityishI $before, WordPoints_EntityishI $after, $settings ) {
247
+	protected function process_modified_entityish(WordPoints_EntityishI $before, WordPoints_EntityishI $after, $settings) {
248 248
 
249
-		if ( ! $this->meets_conditions( $before, $settings['conditions'] ) ) {
250
-			if ( $this->meets_conditions( $after, $settings['conditions'] ) ) {
251
-				$this->award_points( $settings );
249
+		if ( ! $this->meets_conditions($before, $settings['conditions'])) {
250
+			if ($this->meets_conditions($after, $settings['conditions'])) {
251
+				$this->award_points($settings);
252 252
 
253 253
 				// also need to process other eneities that are affected by this
254 254
 				// change, which may have conditions on this, i.e., that could be
@@ -265,38 +265,38 @@  discard block
 block discarded – undo
265 265
 				// then we do indeed need to run through the children/parents.
266 266
 			}
267 267
 		} else {
268
-			if ( ! $this->meets_conditions( $after, $settings['conditions'] ) ) {
269
-				$this->remove_points( $settings );
268
+			if ( ! $this->meets_conditions($after, $settings['conditions'])) {
269
+				$this->remove_points($settings);
270 270
 			}
271 271
 		}
272 272
 	}
273 273
 
274
-	public function deleted( WordPoints_Entity $entity ) {
274
+	public function deleted(WordPoints_Entity $entity) {
275 275
 		// basically the opposite of created().
276
-		$this->process_entityish_reverse( $entity );
276
+		$this->process_entityish_reverse($entity);
277 277
 	}
278 278
 
279
-	protected function meets_conditions( WordPoints_EntityishI $entityish, $conditions ) {
279
+	protected function meets_conditions(WordPoints_EntityishI $entityish, $conditions) {
280 280
 		// use conditions api
281 281
 
282 282
 		return false;
283 283
 	}
284 284
 
285
-	private function award_points( $settings ) {
285
+	private function award_points($settings) {
286 286
 
287
-		$hierarchy = new WordPoints_Entity_Hierarchy( $this->eitnty );
287
+		$hierarchy = new WordPoints_Entity_Hierarchy($this->eitnty);
288 288
 		// todo we'll need to introudce entity array targets, possibly.
289 289
 		// how will we know how to reverse the target reltinoship chains in the UI
290 290
 		// before saving? i guess we'll need to either have a dedicated index fo taht
291 291
 		// or else juust look it up by looping through the relationships (though we'd
292 292
 		// have to remove the entity array {} part from any one-to-many relationships
293 293
 		// and maybe we'd have to add it to others?)
294
-		$targets = $hierarchy->get_from_hierarchy( $settings['target'] );
294
+		$targets = $hierarchy->get_from_hierarchy($settings['target']);
295 295
 
296 296
 		// maybe just one target, maybe several, depending.
297 297
 	}
298 298
 
299
-	private function get_related_entities( WordPoints_Entity $entity ) {
299
+	private function get_related_entities(WordPoints_Entity $entity) {
300 300
 
301 301
 		// what we need is parental conditions. Conditions that go up the chain,
302 302
 		// and look back at parent entities. This way we can handle the info about
Please login to merge, or discard this patch.
src/includes/classes/wpdb/wrapper.php 2 patches
Doc Comments   +20 added lines patch added patch discarded remove patch
@@ -73,12 +73,28 @@  discard block
 block discarded – undo
73 73
 
74 74
 
75 75
 interface WordPoints_WPDB_Query_Data {
76
+
77
+	/**
78
+	 * @return string
79
+	 */
76 80
 	public function get_table_name();
81
+
82
+	/**
83
+	 * @return void
84
+	 */
77 85
 	public function get_where_clause();
78 86
 }
79 87
 
80 88
 interface WordPoints_MySQL_Query_Parser_SimpleI {
89
+
90
+	/**
91
+	 * @return void
92
+	 */
81 93
 	public function get_table_name();
94
+
95
+	/**
96
+	 * @return string
97
+	 */
82 98
 	public function get_where_clause();
83 99
 }
84 100
 
@@ -164,6 +180,10 @@  discard block
 block discarded – undo
164 180
 }
165 181
 
166 182
 interface WordPoints_WPDB_Query_WrapperI {
183
+
184
+	/**
185
+	 * @return void
186
+	 */
167 187
 	public function __construct( $slug, $args, $wpdb );
168 188
 	public function execute();
169 189
 
Please login to merge, or discard this patch.
Spacing   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -11,60 +11,60 @@  discard block
 block discarded – undo
11 11
 
12 12
 	protected $wpdb;
13 13
 
14
-	public function __construct( $wpdb ) {
14
+	public function __construct($wpdb) {
15 15
 		$this->wpdb = $wpdb;
16 16
 	}
17 17
 
18
-	public function __get( $name ) {
18
+	public function __get($name) {
19 19
 		return $this->wpdb->$name;
20 20
 	}
21 21
 
22
-	public function __set( $name, $value ) {
22
+	public function __set($name, $value) {
23 23
 		$this->wpdb->$name = $value;
24 24
 	}
25 25
 
26
-	public function __isset( $name ) {
27
-		return isset( $this->wpdb->$name );
26
+	public function __isset($name) {
27
+		return isset($this->wpdb->$name);
28 28
 	}
29 29
 
30
-	public function __unset( $name ) {
31
-		unset( $this->wpdb->$name );
30
+	public function __unset($name) {
31
+		unset($this->wpdb->$name);
32 32
 	}
33 33
 
34
-	public function __call( $name, $arguments ) {
34
+	public function __call($name, $arguments) {
35 35
 
36
-		$wrappers = wordpoints_apps()->get_sub_app( 'wpdb_wrappers' );
37
-		$slugs = $wrappers->get_child_slugs( $name );
36
+		$wrappers = wordpoints_apps()->get_sub_app('wpdb_wrappers');
37
+		$slugs = $wrappers->get_child_slugs($name);
38 38
 		$should_listen = $query = false;
39 39
 
40 40
 
41
-		switch ( $name ) {
41
+		switch ($name) {
42 42
 
43 43
 			case 'insert':
44 44
 //			case 'replace':
45
-				$query = new WordPoints_WPDB_Query_Data_Array( $this->args[0] );
45
+				$query = new WordPoints_WPDB_Query_Data_Array($this->args[0]);
46 46
 			break;
47 47
 
48 48
 			case 'update':
49
-				$query =  new WordPoints_WPDB_Query_Data_Array( $this->args[0], $this->args[2] );
49
+				$query = new WordPoints_WPDB_Query_Data_Array($this->args[0], $this->args[2]);
50 50
 			break;
51 51
 
52 52
 			case 'delete':
53
-				$query =  new WordPoints_WPDB_Query_Data_Array( $this->args[0], $this->args[1] );
53
+				$query = new WordPoints_WPDB_Query_Data_Array($this->args[0], $this->args[1]);
54 54
 			break;
55 55
 
56 56
 			case 'query':
57
-				$query =  new WordPoints_WPDB_Query_Data_SQL( $this->args[0] );
57
+				$query = new WordPoints_WPDB_Query_Data_SQL($this->args[0]);
58 58
 			break;
59 59
 		}
60 60
 
61
-		if ( $query ) {
61
+		if ($query) {
62 62
 			/** @var WordPoints_WPDB_Query_WrapperI $wrapper */
63
-			$wrapper = $wrappers->get( $name, $query );
63
+			$wrapper = $wrappers->get($name, $query);
64 64
 
65 65
 			$result = $wrapper->execute();
66 66
 		} else {
67
-			$result = call_user_func_array( array( $this->wpdb, $name ), $arguments );
67
+			$result = call_user_func_array(array($this->wpdb, $name), $arguments);
68 68
 		}
69 69
 
70 70
 		return $result;
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 
85 85
 class WordPoints_MySQL_Query_Parser_Simple_Insert implements WordPoints_MySQL_Query_Parser_SimpleI {
86 86
 
87
-	public function __construct( $sql ) {
87
+	public function __construct($sql) {
88 88
 		$this->sql = $sql;
89 89
 	}
90 90
 
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 		// columns will not be needed. then the other code can decide what to do.
100 100
 		// although I guess sense we have the tablel name we could reun the query
101 101
 		// ourselves if we need/want to.
102
-		if ( stripos( $this->sql, 'ON DUPLICATE KEY UPDATE' ) ) {
102
+		if (stripos($this->sql, 'ON DUPLICATE KEY UPDATE')) {
103 103
 
104 104
 		}
105 105
 
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 	 */
120 120
 	protected $parser;
121 121
 
122
-	public function __construct( $sql ) {
122
+	public function __construct($sql) {
123 123
 		$this->sql = $sql;
124 124
 		$this->parser = $this->get_parser();
125 125
 	}
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
 		// of query it is.
131 131
 		// maybe the parser will actually be passed in, and the query type deterimed
132 132
 		// by teh method wrapper.
133
-		$parser = new WordPoints_MySQL_Query_Parser_Simple_Insert( $this->sql );
133
+		$parser = new WordPoints_MySQL_Query_Parser_Simple_Insert($this->sql);
134 134
 		// maybe we don't even need to parse.
135 135
 		return $parser;
136 136
 	}
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
 	protected $table_name;
150 150
 	protected $where_data;
151 151
 
152
-	public function __construct( $table_name, $where_data = array() ) {
152
+	public function __construct($table_name, $where_data = array()) {
153 153
 		$this->table_name = $table_name;
154 154
 		$this->where_data = $where_data;
155 155
 	}
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
 }
165 165
 
166 166
 interface WordPoints_WPDB_Query_WrapperI {
167
-	public function __construct( $slug, $args, $wpdb );
167
+	public function __construct($slug, $args, $wpdb);
168 168
 	public function execute();
169 169
 
170 170
 }
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
 	protected $result;
186 186
 	protected $backed_up_wpdb_vars;
187 187
 
188
-	public function __construct( $slug, $args, $wpdb ) {
188
+	public function __construct($slug, $args, $wpdb) {
189 189
 		$this->slug = $slug;
190 190
 		$this->args = $args;
191 191
 		$this->wpdb = $wpdb;
@@ -194,20 +194,20 @@  discard block
 block discarded – undo
194 194
 
195 195
 	protected function get_query_data() {
196 196
 
197
-		switch ( $this->slug ) {
197
+		switch ($this->slug) {
198 198
 
199 199
 			case 'insert':
200 200
 				//			case 'replace':
201
-				return new WordPoints_WPDB_Query_Data_Array( $this->args[0] );
201
+				return new WordPoints_WPDB_Query_Data_Array($this->args[0]);
202 202
 
203 203
 			case 'update':
204
-				return new WordPoints_WPDB_Query_Data_Array( $this->args[0], $this->args[2] );
204
+				return new WordPoints_WPDB_Query_Data_Array($this->args[0], $this->args[2]);
205 205
 
206 206
 			case 'delete':
207
-				return new WordPoints_WPDB_Query_Data_Array( $this->args[0], $this->args[1] );
207
+				return new WordPoints_WPDB_Query_Data_Array($this->args[0], $this->args[1]);
208 208
 
209 209
 			case 'query':
210
-				return new WordPoints_WPDB_Query_Data_SQL( $this->args[0] );
210
+				return new WordPoints_WPDB_Query_Data_SQL($this->args[0]);
211 211
 		}
212 212
 
213 213
 		return false;
@@ -217,13 +217,13 @@  discard block
 block discarded – undo
217 217
 
218 218
 		$should_listen = $this->should_listen();
219 219
 
220
-		if ( $should_listen ) {
220
+		if ($should_listen) {
221 221
 			$this->before_query();
222 222
 		}
223 223
 
224
-		$this->result = call_user_func_array( array( $this->wpdb, $this->slug ), $this->args );
224
+		$this->result = call_user_func_array(array($this->wpdb, $this->slug), $this->args);
225 225
 
226
-		if ( $should_listen && $this->was_successful_query() ) {
226
+		if ($should_listen && $this->was_successful_query()) {
227 227
 			$this->backup_wpdb_vars();
228 228
 			$this->after_query();
229 229
 			$this->restore_wpdb_vars();
@@ -252,8 +252,8 @@  discard block
 block discarded – undo
252 252
 
253 253
 		// we could check for the availableility of eahc valu here in case of dropins
254 254
 		// or they become not available in the future.
255
-		foreach ( $to_backup as $property ) {
256
-			$this->backed_up_wpdb_vars[ $property ] = $this->wpdb->$property;
255
+		foreach ($to_backup as $property) {
256
+			$this->backed_up_wpdb_vars[$property] = $this->wpdb->$property;
257 257
 		}
258 258
 	}
259 259
 
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
 		// with the backed up result.
264 264
 		$this->wpdb->flush();
265 265
 
266
-		foreach ( $this->backed_up_wpdb_vars as $property => $value ) {
266
+		foreach ($this->backed_up_wpdb_vars as $property => $value) {
267 267
 			$this->wpdb->$property = $value;
268 268
 		}
269 269
 	}
@@ -301,18 +301,18 @@  discard block
 block discarded – undo
301 301
 	 */
302 302
 	protected function is_entity_table() {
303 303
 
304
-		$this->entity = 'new entity object' . $this->data->get_table_name();
304
+		$this->entity = 'new entity object'.$this->data->get_table_name();
305 305
 
306 306
 		return true;
307 307
 	}
308 308
 
309 309
 	public function should_listen() {
310 310
 
311
-		if ( ! $this->data ) {
311
+		if ( ! $this->data) {
312 312
 			return false;
313 313
 		}
314 314
 
315
-		if ( $this->is_entity_table() ) {
315
+		if ($this->is_entity_table()) {
316 316
 			return false;
317 317
 		}
318 318
 
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
 	}
321 321
 
322 322
 	protected function was_successful_query() {
323
-		return (bool) wordpoints_posint( $not_by_ref = $this->wpdb->num_rows );
323
+		return (bool) wordpoints_posint($not_by_ref = $this->wpdb->num_rows);
324 324
 	}
325 325
 }
326 326
 
@@ -330,7 +330,7 @@  discard block
 block discarded – undo
330 330
 	protected $args;
331 331
 	protected $wpdb;
332 332
 
333
-	public function __construct( $slug, $args, $wpdb ) {
333
+	public function __construct($slug, $args, $wpdb) {
334 334
 		$this->slug = $slug;
335 335
 		$this->args = $args;
336 336
 		$this->wpdb = $wpdb;
@@ -341,10 +341,10 @@  discard block
 block discarded – undo
341 341
 		// check if this is a query that we want to listen to.
342 342
 		// if so, call execute on a particular child.
343 343
 		// otherwise, just call execute.
344
-		if ( $this->get_query_type() ) {
344
+		if ($this->get_query_type()) {
345 345
 
346 346
 		} else {
347
-			$result = call_user_func_array( array( $this->wpdb, $this->slug ), $this->args );
347
+			$result = call_user_func_array(array($this->wpdb, $this->slug), $this->args);
348 348
 		}
349 349
 
350 350
 		return $result;
@@ -369,15 +369,15 @@  discard block
 block discarded – undo
369 369
 
370 370
 		$ids = $this->get_entity_ids();
371 371
 
372
-		$this->entities = new WordPoints_Entity_Array( $this->entity->get_slug() );
373
-		$this->entities->set_the_value( $ids );
372
+		$this->entities = new WordPoints_Entity_Array($this->entity->get_slug());
373
+		$this->entities->set_the_value($ids);
374 374
 	}
375 375
 
376 376
 	protected function get_entity_ids() {
377 377
 		$where = $this->data->get_where_clause();
378
-		$id_field = wordpoints_escape_mysql_identifier( $this->entity->get_id_field() );
379
-		$table_name = wordpoints_escape_mysql_identifier( $this->data->get_table_name() );
380
-		return $this->wpdb->get_col( "SELECT {$id_field} FROM {$table_name} {$where}" );
378
+		$id_field = wordpoints_escape_mysql_identifier($this->entity->get_id_field());
379
+		$table_name = wordpoints_escape_mysql_identifier($this->data->get_table_name());
380
+		return $this->wpdb->get_col("SELECT {$id_field} FROM {$table_name} {$where}");
381 381
 	}
382 382
 
383 383
 	protected function after_query() {
@@ -396,13 +396,13 @@  discard block
 block discarded – undo
396 396
 		$where_clause = $this->data->get_where_clause();
397 397
 
398 398
 		// get a before snapshot, if any matching are found.
399
-		if ( $where_clause ) {
399
+		if ($where_clause) {
400 400
 
401 401
 		}
402 402
 	}
403 403
 
404 404
 	protected function after_query() {
405
-		$this->entity->set_the_value( $this->wpdb->insert_id );
405
+		$this->entity->set_the_value($this->wpdb->insert_id);
406 406
 		// I guess we invoke the api to run the action now?
407 407
 		$this->trigger_entity_create_actions();
408 408
 	}
@@ -413,7 +413,7 @@  discard block
 block discarded – undo
413 413
 
414 414
 	protected function after_query() {
415 415
 		// I guess we invoke the api to run the action now?
416
-		$this->trigger_entity_delete_actions( $this->entities );
416
+		$this->trigger_entity_delete_actions($this->entities);
417 417
 	}
418 418
 }
419 419
 
Please login to merge, or discard this patch.
src/includes/classes/hook/extension/repeat/blocker.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -22,22 +22,22 @@
 block discarded – undo
22 22
 	/**
23 23
 	 * @since 1.0.0
24 24
 	 */
25
-	protected function validate_action_type_settings( $settings ) {
25
+	protected function validate_action_type_settings($settings) {
26 26
 		return (bool) $settings;
27 27
 	}
28 28
 
29 29
 	/**
30 30
 	 * @since 1.0.0
31 31
 	 */
32
-	public function should_hit( WordPoints_Hook_Fire $fire ) {
32
+	public function should_hit(WordPoints_Hook_Fire $fire) {
33 33
 
34
-		$block_repeats = (bool) $this->get_settings_from_fire( $fire );
34
+		$block_repeats = (bool) $this->get_settings_from_fire($fire);
35 35
 
36
-		if ( ! $block_repeats ) {
36
+		if ( ! $block_repeats) {
37 37
 			return true;
38 38
 		}
39 39
 
40
-		if ( $fire->get_matching_hits_query()->count() > 0 ) {
40
+		if ($fire->get_matching_hits_query()->count() > 0) {
41 41
 			return false;
42 42
 		}
43 43
 
Please login to merge, or discard this patch.