Completed
Push — master ( 82b9ae...b792a1 )
by J.D.
02:52
created
src/includes/classes/class/registry.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -30,39 +30,39 @@  discard block
 block discarded – undo
30 30
 	/**
31 31
 	 * @since 1.0.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 1.0.0
39 39
 	 */
40
-	public function get( $slug, array $args = array() ) {
40
+	public function get($slug, array $args = array()) {
41 41
 
42
-		if ( ! isset( $this->classes[ $slug ] ) ) {
42
+		if ( ! isset($this->classes[$slug])) {
43 43
 			return false;
44 44
 		}
45 45
 
46
-		if ( ! empty( $args ) ) {
46
+		if ( ! empty($args)) {
47 47
 
48
-			array_unshift( $args, $slug );
48
+			array_unshift($args, $slug);
49 49
 
50 50
 			return wordpoints_construct_class_with_args(
51
-				$this->classes[ $slug ]
51
+				$this->classes[$slug]
52 52
 				, $args
53 53
 			);
54 54
 
55 55
 		} else {
56
-			return new $this->classes[ $slug ]( $slug );
56
+			return new $this->classes[$slug]($slug);
57 57
 		}
58 58
 	}
59 59
 
60 60
 	/**
61 61
 	 * @since 1.0.0
62 62
 	 */
63
-	public function register( $slug, $class, array $args = array() ) {
63
+	public function register($slug, $class, array $args = array()) {
64 64
 
65
-		$this->classes[ $slug ] = $class;
65
+		$this->classes[$slug] = $class;
66 66
 
67 67
 		return true;
68 68
 	}
@@ -70,17 +70,17 @@  discard block
 block discarded – undo
70 70
 	/**
71 71
 	 * @since 1.0.0
72 72
 	 */
73
-	public function deregister( $slug ) {
73
+	public function deregister($slug) {
74 74
 
75
-		unset( $this->classes[ $slug ] );
75
+		unset($this->classes[$slug]);
76 76
 	}
77 77
 
78 78
 	/**
79 79
 	 * @since 1.0.0
80 80
 	 */
81
-	public function is_registered( $slug ) {
81
+	public function is_registered($slug) {
82 82
 
83
-		return isset( $this->classes[ $slug ] );
83
+		return isset($this->classes[$slug]);
84 84
 	}
85 85
 
86 86
 	/**
@@ -94,24 +94,24 @@  discard block
 block discarded – undo
94 94
 	 *
95 95
 	 * @return object[] An array of the constructed objects.
96 96
 	 */
97
-	public static function construct_with_args( array $classes, array $args ) {
97
+	public static function construct_with_args(array $classes, array $args) {
98 98
 
99 99
 		$objects = array();
100 100
 
101
-		if ( empty( $args ) ) {
101
+		if (empty($args)) {
102 102
 
103
-			foreach ( $classes as $slug => $class ) {
104
-				$objects[ $slug ] = new $class( $slug );
103
+			foreach ($classes as $slug => $class) {
104
+				$objects[$slug] = new $class($slug);
105 105
 			}
106 106
 
107 107
 		} else {
108 108
 
109
-			array_unshift( $args, null );
109
+			array_unshift($args, null);
110 110
 
111
-			foreach ( $classes as $slug => $class ) {
112
-				$objects[ $slug ] = wordpoints_construct_class_with_args(
111
+			foreach ($classes as $slug => $class) {
112
+				$objects[$slug] = wordpoints_construct_class_with_args(
113 113
 					$class
114
-					, array( $slug ) + $args
114
+					, array($slug) + $args
115 115
 				);
116 116
 			}
117 117
 		}
Please login to merge, or discard this patch.
src/includes/classes/class/registry/children.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -33,12 +33,12 @@  discard block
 block discarded – undo
33 33
 	/**
34 34
 	 * @since 1.0.0
35 35
 	 */
36
-	public function get_all( array $args = array() ) {
36
+	public function get_all(array $args = array()) {
37 37
 
38 38
 		$items = array();
39 39
 
40
-		foreach ( $this->classes as $parent_slug => $classes ) {
41
-			$items[ $parent_slug ] = WordPoints_Class_Registry::construct_with_args(
40
+		foreach ($this->classes as $parent_slug => $classes) {
41
+			$items[$parent_slug] = WordPoints_Class_Registry::construct_with_args(
42 42
 				$classes
43 43
 				, $args
44 44
 			);
@@ -50,14 +50,14 @@  discard block
 block discarded – undo
50 50
 	/**
51 51
 	 * @since 1.0.0
52 52
 	 */
53
-	public function get_children( $parent_slug, array $args = array() ) {
53
+	public function get_children($parent_slug, array $args = array()) {
54 54
 
55 55
 		$items = array();
56 56
 
57
-		if ( isset( $this->classes[ $parent_slug ] ) ) {
57
+		if (isset($this->classes[$parent_slug])) {
58 58
 
59 59
 			$items = WordPoints_Class_Registry::construct_with_args(
60
-				$this->classes[ $parent_slug ]
60
+				$this->classes[$parent_slug]
61 61
 				, $args
62 62
 			);
63 63
 		}
@@ -68,29 +68,29 @@  discard block
 block discarded – undo
68 68
 	/**
69 69
 	 * @since 1.0.0
70 70
 	 */
71
-	public function get( $parent_slug, $slug, array $args = array() ) {
71
+	public function get($parent_slug, $slug, array $args = array()) {
72 72
 
73
-		if ( ! isset( $this->classes[ $parent_slug ][ $slug ] ) ) {
73
+		if ( ! isset($this->classes[$parent_slug][$slug])) {
74 74
 			return false;
75 75
 		}
76 76
 
77
-		$class = $this->classes[ $parent_slug ][ $slug ];
77
+		$class = $this->classes[$parent_slug][$slug];
78 78
 
79
-		if ( empty( $args ) ) {
80
-			return new $class( $slug );
79
+		if (empty($args)) {
80
+			return new $class($slug);
81 81
 		} else {
82
-			array_unshift( $args, $slug );
82
+			array_unshift($args, $slug);
83 83
 
84
-			return wordpoints_construct_class_with_args( $class, $args );
84
+			return wordpoints_construct_class_with_args($class, $args);
85 85
 		}
86 86
 	}
87 87
 
88 88
 	/**
89 89
 	 * @since 1.0.0
90 90
 	 */
91
-	public function register( $parent_slug, $slug, $class, array $args = array() ) {
91
+	public function register($parent_slug, $slug, $class, array $args = array()) {
92 92
 
93
-		$this->classes[ $parent_slug ][ $slug ] = $class;
93
+		$this->classes[$parent_slug][$slug] = $class;
94 94
 
95 95
 		return true;
96 96
 	}
@@ -98,26 +98,26 @@  discard block
 block discarded – undo
98 98
 	/**
99 99
 	 * @since 1.0.0
100 100
 	 */
101
-	public function deregister( $parent_slug, $slug ) {
102
-		unset( $this->classes[ $parent_slug ][ $slug ] );
101
+	public function deregister($parent_slug, $slug) {
102
+		unset($this->classes[$parent_slug][$slug]);
103 103
 	}
104 104
 
105 105
 	/**
106 106
 	 * @since 1.0.0
107 107
 	 */
108
-	public function deregister_children( $parent_slug ) {
109
-		unset( $this->classes[ $parent_slug ] );
108
+	public function deregister_children($parent_slug) {
109
+		unset($this->classes[$parent_slug]);
110 110
 	}
111 111
 
112 112
 	/**
113 113
 	 * @since 1.0.0
114 114
 	 */
115
-	public function is_registered( $parent_slug, $slug = null ) {
115
+	public function is_registered($parent_slug, $slug = null) {
116 116
 
117
-		if ( isset( $slug ) ) {
118
-			return isset( $this->classes[ $parent_slug ][ $slug ] );
117
+		if (isset($slug)) {
118
+			return isset($this->classes[$parent_slug][$slug]);
119 119
 		} else {
120
-			return isset( $this->classes[ $parent_slug ] );
120
+			return isset($this->classes[$parent_slug]);
121 121
 		}
122 122
 	}
123 123
 }
Please login to merge, or discard this patch.
src/includes/classes/class/registry/childreni.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 	 *
38 38
 	 * @return object[] The child objects, indexed by slug.
39 39
 	 */
40
-	public function get_children( $parent_slug );
40
+	public function get_children($parent_slug);
41 41
 
42 42
 	/**
43 43
 	 * Get an object by its slug.
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 	 *
50 50
 	 * @return object|false The object or false on failure.
51 51
 	 */
52
-	public function get( $parent_slug, $slug );
52
+	public function get($parent_slug, $slug);
53 53
 
54 54
 	/**
55 55
 	 * 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( $parent_slug, $slug, $class, array $args = array() );
66
+	public function register($parent_slug, $slug, $class, array $args = array());
67 67
 
68 68
 	/**
69 69
 	 * Deregister a type of object.
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 	 * @param string $parent_slug The group slug.
74 74
 	 * @param string $slug        The slug of the class to deregister.
75 75
 	 */
76
-	public function deregister( $parent_slug, $slug );
76
+	public function deregister($parent_slug, $slug);
77 77
 
78 78
 	/**
79 79
 	 * Deregister all children of a particular parent.
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 	 *
83 83
 	 * @param string $parent_slug The group slug.
84 84
 	 */
85
-	public function deregister_children( $parent_slug );
85
+	public function deregister_children($parent_slug);
86 86
 
87 87
 	/**
88 88
 	 * Check if a type of object is registered by its slug.
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 	 *
98 98
 	 * @return bool Whether the class is registered.
99 99
 	 */
100
-	public function is_registered( $parent_slug, $slug = null );
100
+	public function is_registered($parent_slug, $slug = null);
101 101
 }
102 102
 
103 103
 // EOF
Please login to merge, or discard this patch.
src/includes/classes/class/registry/persistent.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -29,11 +29,11 @@  discard block
 block discarded – undo
29 29
 	/**
30 30
 	 * @since 1.0.0
31 31
 	 */
32
-	public function get_all( array $args = array() ) {
32
+	public function get_all(array $args = array()) {
33 33
 
34
-		$classes = array_diff_key( $this->classes, $this->objects );
34
+		$classes = array_diff_key($this->classes, $this->objects);
35 35
 
36
-		if ( ! empty( $classes ) ) {
36
+		if ( ! empty($classes)) {
37 37
 
38 38
 			$objects = WordPoints_Class_Registry::construct_with_args(
39 39
 				$classes
@@ -49,40 +49,40 @@  discard block
 block discarded – undo
49 49
 	/**
50 50
 	 * @since 1.0.0
51 51
 	 */
52
-	public function get( $slug, array $args = array() ) {
52
+	public function get($slug, array $args = array()) {
53 53
 
54
-		if ( ! isset( $this->objects[ $slug ] ) ) {
54
+		if ( ! isset($this->objects[$slug])) {
55 55
 
56
-			$object = parent::get( $slug, $args );
56
+			$object = parent::get($slug, $args);
57 57
 
58
-			if ( ! $object ) {
58
+			if ( ! $object) {
59 59
 				return false;
60 60
 			}
61 61
 
62
-			$this->objects[ $slug ] = $object;
62
+			$this->objects[$slug] = $object;
63 63
 		}
64 64
 
65
-		return $this->objects[ $slug ];
65
+		return $this->objects[$slug];
66 66
 	}
67 67
 
68 68
 	/**
69 69
 	 * @since 1.0.0
70 70
 	 */
71
-	public function register( $slug, $class, array $args = array() ) {
71
+	public function register($slug, $class, array $args = array()) {
72 72
 
73
-		unset( $this->objects[ $slug ] );
73
+		unset($this->objects[$slug]);
74 74
 
75
-		return parent::register( $slug, $class, $args );
75
+		return parent::register($slug, $class, $args);
76 76
 	}
77 77
 
78 78
 	/**
79 79
 	 * @since 1.0.0
80 80
 	 */
81
-	public function deregister( $slug ) {
81
+	public function deregister($slug) {
82 82
 
83
-		parent::deregister( $slug );
83
+		parent::deregister($slug);
84 84
 
85
-		unset( $this->objects[ $slug ] );
85
+		unset($this->objects[$slug]);
86 86
 	}
87 87
 }
88 88
 
Please login to merge, or discard this patch.
src/includes/classes/class/registryi.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 	 *
42 42
 	 * @return object|false The object or false if it is not registered.
43 43
 	 */
44
-	public function get( $slug );
44
+	public function get($slug);
45 45
 
46 46
 	/**
47 47
 	 * Register a type of object.
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 	 *
55 55
 	 * @return bool Whether the class was registered successfully.
56 56
 	 */
57
-	public function register( $slug, $class, array $args = array() );
57
+	public function register($slug, $class, array $args = array());
58 58
 
59 59
 	/**
60 60
 	 * Deregister a type of object
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 	 *
64 64
 	 * @param string $slug The slug of the class to deregister.
65 65
 	 */
66
-	public function deregister( $slug );
66
+	public function deregister($slug);
67 67
 
68 68
 	/**
69 69
 	 * Check if a type of object is registered by its slug.
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 	 *
75 75
 	 * @return bool Whether the class is registered.
76 76
 	 */
77
-	public function is_registered( $slug );
77
+	public function is_registered($slug);
78 78
 }
79 79
 
80 80
 // EOF
Please login to merge, or discard this patch.
src/includes/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 1.0.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/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.