Completed
Push — master ( aa04da...b6760c )
by J.D.
02:59
created
src/includes/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 1.0.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/includes/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/includes/classes/entity.php 1 patch
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -80,11 +80,11 @@  discard block
 block discarded – undo
80 80
 	 *
81 81
 	 * @return mixed The entity, or false if not found.
82 82
 	 */
83
-	protected function get_entity( $id ) {
83
+	protected function get_entity($id) {
84 84
 
85
-		$entity = call_user_func( $this->getter, $id );
85
+		$entity = call_user_func($this->getter, $id);
86 86
 
87
-		if ( ! $this->is_entity( $entity ) ) {
87
+		if ( ! $this->is_entity($entity)) {
88 88
 			return false;
89 89
 		}
90 90
 
@@ -100,13 +100,13 @@  discard block
 block discarded – undo
100 100
 	 *
101 101
 	 * @return bool Whether the passed value is an entity.
102 102
 	 */
103
-	protected function is_entity( $entity ) {
103
+	protected function is_entity($entity) {
104 104
 
105
-		if ( ! is_object( $entity ) && ! is_array( $entity ) ) {
105
+		if ( ! is_object($entity) && ! is_array($entity)) {
106 106
 			return false;
107 107
 		}
108 108
 
109
-		return (bool) $this->get_entity_id( $entity );
109
+		return (bool) $this->get_entity_id($entity);
110 110
 	}
111 111
 
112 112
 	/**
@@ -119,14 +119,14 @@  discard block
 block discarded – undo
119 119
 	 *
120 120
 	 * @return mixed The value of the attribute of the entity.
121 121
 	 */
122
-	protected function get_attr_value( $entity, $attr ) {
122
+	protected function get_attr_value($entity, $attr) {
123 123
 
124
-		if ( is_array( $entity ) ) {
125
-			if ( isset( $entity[ $attr ] ) ) {
126
-				return $entity[ $attr ];
124
+		if (is_array($entity)) {
125
+			if (isset($entity[$attr])) {
126
+				return $entity[$attr];
127 127
 			}
128 128
 		} else {
129
-			if ( isset( $entity->{$attr} ) ) {
129
+			if (isset($entity->{$attr} )) {
130 130
 				return $entity->{$attr};
131 131
 			}
132 132
 		}
@@ -143,8 +143,8 @@  discard block
 block discarded – undo
143 143
 	 *
144 144
 	 * @return mixed The ID of the entity.
145 145
 	 */
146
-	protected function get_entity_id( $entity ) {
147
-		return $this->get_attr_value( $entity, $this->get_id_field() );
146
+	protected function get_entity_id($entity) {
147
+		return $this->get_attr_value($entity, $this->get_id_field());
148 148
 	}
149 149
 
150 150
 	/**
@@ -160,8 +160,8 @@  discard block
 block discarded – undo
160 160
 	 *
161 161
 	 * @return mixed The human ID of the entity.
162 162
 	 */
163
-	protected function get_entity_human_id( $entity ) {
164
-		return $this->get_attr_value( $entity, $this->human_id_field );
163
+	protected function get_entity_human_id($entity) {
164
+		return $this->get_attr_value($entity, $this->human_id_field);
165 165
 	}
166 166
 
167 167
 	//
@@ -192,15 +192,15 @@  discard block
 block discarded – undo
192 192
 	 *
193 193
 	 * @return string|int|float|false The human identifier for the entity, or false.
194 194
 	 */
195
-	public function get_human_id( $id ) {
195
+	public function get_human_id($id) {
196 196
 
197
-		$entity = $this->get_entity( $id );
197
+		$entity = $this->get_entity($id);
198 198
 
199
-		if ( ! $entity ) {
199
+		if ( ! $entity) {
200 200
 			return false;
201 201
 		}
202 202
 
203
-		return $this->get_entity_human_id( $entity );
203
+		return $this->get_entity_human_id($entity);
204 204
 	}
205 205
 
206 206
 	/**
@@ -212,8 +212,8 @@  discard block
 block discarded – undo
212 212
 	 *
213 213
 	 * @return bool Whether or not an entity with that ID exists.
214 214
 	 */
215
-	public function exists( $id ) {
216
-		return (bool) $this->get_entity( $id );
215
+	public function exists($id) {
216
+		return (bool) $this->get_entity($id);
217 217
 	}
218 218
 
219 219
 	/**
@@ -228,17 +228,17 @@  discard block
 block discarded – undo
228 228
 	 *
229 229
 	 * @return WordPoints_Entityish|false The child's object, or false if not found.
230 230
 	 */
231
-	public function get_child( $child_slug ) {
231
+	public function get_child($child_slug) {
232 232
 
233 233
 		$children = wordpoints_entities()->children;
234 234
 
235
-		$child = $children->get( $this->slug, $child_slug );
235
+		$child = $children->get($this->slug, $child_slug);
236 236
 
237 237
 		if (
238
-			isset( $this->the_value )
238
+			isset($this->the_value)
239 239
 			&& $child instanceof WordPoints_Entity_ChildI
240 240
 		) {
241
-			$child->set_the_value_from_entity( $this );
241
+			$child->set_the_value_from_entity($this);
242 242
 		}
243 243
 
244 244
 		return $child;
@@ -260,20 +260,20 @@  discard block
 block discarded – undo
260 260
 	 *
261 261
 	 * @return bool Whether the value was set.
262 262
 	 */
263
-	public function set_the_value( $value ) {
263
+	public function set_the_value($value) {
264 264
 
265 265
 		$this->the_value = $this->the_entity = null;
266 266
 
267
-		if ( $this->is_entity( $value ) ) {
267
+		if ($this->is_entity($value)) {
268 268
 
269 269
 			$entity = $value;
270
-			$value = $this->get_entity_id( $value );
270
+			$value = $this->get_entity_id($value);
271 271
 
272 272
 		} else {
273 273
 
274
-			$entity = $this->get_entity( $value );
274
+			$entity = $this->get_entity($value);
275 275
 
276
-			if ( ! $entity ) {
276
+			if ( ! $entity) {
277 277
 				return false;
278 278
 			}
279 279
 		}
@@ -293,8 +293,8 @@  discard block
 block discarded – undo
293 293
 	 *
294 294
 	 * @return mixed The value of the attribute.
295 295
 	 */
296
-	public function get_the_attr_value( $attr ) {
297
-		return $this->get_attr_value( $this->the_entity, $attr );
296
+	public function get_the_attr_value($attr) {
297
+		return $this->get_attr_value($this->the_entity, $attr);
298 298
 	}
299 299
 
300 300
 	/**
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
 	 * @return string|int|float|null The human identifier for the entity, or null.
319 319
 	 */
320 320
 	public function get_the_human_id() {
321
-		return $this->get_entity_human_id( $this->the_entity );
321
+		return $this->get_entity_human_id($this->the_entity);
322 322
 	}
323 323
 }
324 324
 
Please login to merge, or discard this patch.
src/includes/classes/entity/array.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -52,12 +52,12 @@  discard block
 block discarded – undo
52 52
 	 *
53 53
 	 * @param string $entity_slug The slug of the entity type.
54 54
 	 */
55
-	public function __construct( $entity_slug ) {
55
+	public function __construct($entity_slug) {
56 56
 
57 57
 		$this->entity_slug = $entity_slug;
58
-		$this->entity_object = wordpoints_entities()->get( $this->entity_slug );
58
+		$this->entity_object = wordpoints_entities()->get($this->entity_slug);
59 59
 
60
-		parent::__construct( $this->entity_slug . '{}' );
60
+		parent::__construct($this->entity_slug.'{}');
61 61
 	}
62 62
 
63 63
 	/**
@@ -80,19 +80,19 @@  discard block
 block discarded – undo
80 80
 	 *
81 81
 	 * @return bool Whether the value was set successfully.
82 82
 	 */
83
-	public function set_the_value( $values ) {
83
+	public function set_the_value($values) {
84 84
 
85 85
 		$this->the_entities = $this->the_value = array();
86 86
 
87
-		if ( ! ( $this->entity_object instanceof WordPoints_Entity ) ) {
87
+		if ( ! ($this->entity_object instanceof WordPoints_Entity)) {
88 88
 			return false;
89 89
 		}
90 90
 
91
-		foreach ( $values as $value ) {
91
+		foreach ($values as $value) {
92 92
 
93 93
 			$entity = clone $this->entity_object;
94 94
 
95
-			if ( $entity->set_the_value( $value ) ) {
95
+			if ($entity->set_the_value($value)) {
96 96
 				$this->the_entities[] = $entity;
97 97
 				$this->the_value[] = $entity->get_the_id();
98 98
 			}
@@ -117,16 +117,16 @@  discard block
 block discarded – undo
117 117
 	 */
118 118
 	public function get_title() {
119 119
 
120
-		if ( $this->entity_object ) {
120
+		if ($this->entity_object) {
121 121
 
122 122
 			return sprintf(
123 123
 				// translators: the singular name of an item
124
-				__( '%s Collection', 'wordpoints' )
124
+				__('%s Collection', 'wordpoints')
125 125
 				, $this->entity_object->get_title()
126 126
 			);
127 127
 
128 128
 		} else {
129
-			return __( 'Item Collection', 'wordpoints' );
129
+			return __('Item Collection', 'wordpoints');
130 130
 		}
131 131
 	}
132 132
 }
Please login to merge, or discard this patch.
src/includes/classes/entity/attr.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -78,9 +78,9 @@
 block discarded – undo
78 78
 	 *
79 79
 	 * @return bool Whether the value was set correctly.
80 80
 	 */
81
-	public function set_the_value_from_entity( WordPoints_Entity $entity ) {
81
+	public function set_the_value_from_entity(WordPoints_Entity $entity) {
82 82
 
83
-		$this->the_value = $entity->get_the_attr_value( $this->get_field() );
83
+		$this->the_value = $entity->get_the_attr_value($this->get_field());
84 84
 
85 85
 		return true;
86 86
 	}
Please login to merge, or discard this patch.
src/includes/classes/entity/childi.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@
 block discarded – undo
23 23
 	 *
24 24
 	 * @return bool Whether the value was set successfully.
25 25
 	 */
26
-	public function set_the_value_from_entity( WordPoints_Entity $entity );
26
+	public function set_the_value_from_entity(WordPoints_Entity $entity);
27 27
 }
28 28
 
29 29
 // EOF
Please login to merge, or discard this patch.
src/includes/classes/entity/comment.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -24,12 +24,12 @@  discard block
 block discarded – undo
24 24
 	/**
25 25
 	 * @since 1.0.0
26 26
 	 */
27
-	protected function get_entity( $id ) {
27
+	protected function get_entity($id) {
28 28
 
29 29
 		// We must do this because the $id parameter is expected by reference.
30
-		$comment = get_comment( $id );
30
+		$comment = get_comment($id);
31 31
 
32
-		if ( ! $comment ) {
32
+		if ( ! $comment) {
33 33
 			return false;
34 34
 		}
35 35
 
@@ -39,28 +39,28 @@  discard block
 block discarded – undo
39 39
 	/**
40 40
 	 * @since 1.0.0
41 41
 	 */
42
-	protected function get_entity_human_id( $entity ) {
42
+	protected function get_entity_human_id($entity) {
43 43
 		// An extra space is added to the end in WP <4.4 if the comment is short.
44 44
 		// See https://core.trac.wordpress.org/ticket/27526#comment:5
45
-		return rtrim( get_comment_excerpt( $entity->comment_ID ) );
45
+		return rtrim(get_comment_excerpt($entity->comment_ID));
46 46
 	}
47 47
 
48 48
 	/**
49 49
 	 * @since 1.0.0
50 50
 	 */
51 51
 	public function get_title() {
52
-		return __( 'Comment', 'wordpoints' );
52
+		return __('Comment', 'wordpoints');
53 53
 	}
54 54
 
55 55
 	/**
56 56
 	 * @since 1.0.0
57 57
 	 */
58
-	public function user_can_view( $user_id, $id ) {
58
+	public function user_can_view($user_id, $id) {
59 59
 
60
-		$comment = get_comment( $id );
60
+		$comment = get_comment($id);
61 61
 
62
-		if ( $comment ) {
63
-			return user_can( $user_id, 'read_post', $comment->comment_post_ID );
62
+		if ($comment) {
63
+			return user_can($user_id, 'read_post', $comment->comment_post_ID);
64 64
 		}
65 65
 
66 66
 		return false;
Please login to merge, or discard this patch.
src/includes/classes/entity/comment/post.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@
 block discarded – undo
33 33
 	 * @since 1.0.0
34 34
 	 */
35 35
 	public function get_title() {
36
-		return __( 'Post', 'wordpoints' );
36
+		return __('Post', 'wordpoints');
37 37
 	}
38 38
 }
39 39
 
Please login to merge, or discard this patch.
src/includes/classes/entity/hierarchy.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -48,9 +48,9 @@  discard block
 block discarded – undo
48 48
 	 *
49 49
 	 * @param WordPoints_Entity|null $entity An entity.
50 50
 	 */
51
-	public function __construct( WordPoints_Entity $entity = null ) {
52
-		if ( isset( $entity ) ) {
53
-			$this->add_entity( $entity );
51
+	public function __construct(WordPoints_Entity $entity = null) {
52
+		if (isset($entity)) {
53
+			$this->add_entity($entity);
54 54
 		}
55 55
 	}
56 56
 
@@ -64,20 +64,20 @@  discard block
 block discarded – undo
64 64
 	/**
65 65
 	 * @since 1.0.0
66 66
 	 */
67
-	public function add_entity( WordPoints_Entity $entity ) {
67
+	public function add_entity(WordPoints_Entity $entity) {
68 68
 
69
-		$this->entities[ $entity->get_slug() ] = $entity;
69
+		$this->entities[$entity->get_slug()] = $entity;
70 70
 	}
71 71
 
72 72
 	/**
73 73
 	 * @since 1.0.0
74 74
 	 */
75
-	public function remove_entity( $slug ) {
75
+	public function remove_entity($slug) {
76 76
 
77
-		unset( $this->entities[ $slug ] );
77
+		unset($this->entities[$slug]);
78 78
 
79 79
 		if (
80
-			isset( $this->hierarchy[0] )
80
+			isset($this->hierarchy[0])
81 81
 			&& $this->hierarchy[0]->get_slug() === $slug
82 82
 		) {
83 83
 			$this->current = null;
@@ -88,30 +88,30 @@  discard block
 block discarded – undo
88 88
 	/**
89 89
 	 * @since 1.0.0
90 90
 	 */
91
-	public function descend( $child_slug ) {
91
+	public function descend($child_slug) {
92 92
 
93
-		if ( ! $this->current ) {
93
+		if ( ! $this->current) {
94 94
 
95
-			if ( ! isset( $this->entities[ $child_slug ] ) ) {
95
+			if ( ! isset($this->entities[$child_slug])) {
96 96
 				return false;
97 97
 			}
98 98
 
99
-			$child = $this->entities[ $child_slug ];
99
+			$child = $this->entities[$child_slug];
100 100
 
101 101
 		} else {
102 102
 
103
-			if ( ! ( $this->current instanceof WordPoints_Entity_ParentI ) ) {
103
+			if ( ! ($this->current instanceof WordPoints_Entity_ParentI)) {
104 104
 				return false;
105 105
 			}
106 106
 
107
-			$child = $this->current->get_child( $child_slug );
107
+			$child = $this->current->get_child($child_slug);
108 108
 
109
-			if ( ! $child ) {
109
+			if ( ! $child) {
110 110
 				return false;
111 111
 			}
112 112
 		}
113 113
 
114
-		if ( $this->current ) {
114
+		if ($this->current) {
115 115
 			$this->hierarchy[] = $this->current;
116 116
 		}
117 117
 
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
 	 */
126 126
 	public function ascend() {
127 127
 
128
-		if ( empty( $this->current ) ) {
128
+		if (empty($this->current)) {
129 129
 
130 130
 			// We're already at the top, some logic is probably wrong.
131 131
 			_doing_it_wrong(
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 			return false;
138 138
 		}
139 139
 
140
-		$this->current = array_pop( $this->hierarchy );
140
+		$this->current = array_pop($this->hierarchy);
141 141
 
142 142
 		return true;
143 143
 	}
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
 	/**
153 153
 	 * @since 1.0.0
154 154
 	 */
155
-	public function get_from_hierarchy( array $hierarchy ) {
155
+	public function get_from_hierarchy(array $hierarchy) {
156 156
 
157 157
 		$backup = $this->hierarchy;
158 158
 		$current = $this->current;
@@ -160,16 +160,16 @@  discard block
 block discarded – undo
160 160
 		$this->hierarchy = array();
161 161
 		$this->current = null;
162 162
 
163
-		$slug = reset( $hierarchy );
163
+		$slug = reset($hierarchy);
164 164
 
165
-		while ( $slug ) {
165
+		while ($slug) {
166 166
 
167
-			if ( ! $this->descend( $slug ) ) {
167
+			if ( ! $this->descend($slug)) {
168 168
 				$this->current = null;
169 169
 				break;
170 170
 			}
171 171
 
172
-			$slug = next( $hierarchy );
172
+			$slug = next($hierarchy);
173 173
 		}
174 174
 
175 175
 		$entityish = $this->current;
Please login to merge, or discard this patch.