Completed
Pull Request — master (#3)
by James
03:03
created
src/Contract/Core/Container.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 	 *
21 21
 	 * @return $this
22 22
 	 */
23
-	public function define( $alias, $definition );
23
+	public function define($alias, $definition);
24 24
 
25 25
 	/**
26 26
 	 * Defines a new singleton on the Container.
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 	 *
34 34
 	 * @return $this
35 35
 	 */
36
-	public function share( $alias, $definition );
36
+	public function share($alias, $definition);
37 37
 
38 38
 	/**
39 39
 	 * Fetches the value for the provided alias.
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 	 *
43 43
 	 * @return mixed
44 44
 	 */
45
-	public function fetch( $alias );
45
+	public function fetch($alias);
46 46
 
47 47
 	/**
48 48
 	 * Checks whether the provided alias exists on the container.
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 	 *
52 52
 	 * @return bool
53 53
 	 */
54
-	public function has( $alias );
54
+	public function has($alias);
55 55
 
56 56
 	/**
57 57
 	 * Removes the provided alias from the container.
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 	 *
61 61
 	 * @return bool
62 62
 	 */
63
-	public function remove( $alias );
63
+	public function remove($alias);
64 64
 
65 65
 	/**
66 66
 	 * Registers a service provider with the container.
@@ -72,5 +72,5 @@  discard block
 block discarded – undo
72 72
 	 *
73 73
 	 * @param ServiceProvider $provider
74 74
 	 */
75
-	public function register( ServiceProvider $provider );
75
+	public function register(ServiceProvider $provider);
76 76
 }
Please login to merge, or discard this patch.
src/Contract/Assets/Register.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -13,21 +13,21 @@
 block discarded – undo
13 13
 	 *
14 14
 	 * @param bool $debug
15 15
 	 */
16
-	public function set_debug( $debug );
16
+	public function set_debug($debug);
17 17
 
18 18
 	/**
19 19
 	 * Provides a method to register new scripts outside of the constructor.
20 20
 	 *
21 21
 	 * @param $script
22 22
 	 */
23
-	public function register_script( $script );
23
+	public function register_script($script);
24 24
 
25 25
 	/**
26 26
 	 * Provides a method to register new styles outside of the constructor.
27 27
 	 *
28 28
 	 * @param $style
29 29
 	 */
30
-	public function register_style( $style );
30
+	public function register_style($style);
31 31
 
32 32
 	/**
33 33
 	 * Enqueues the web & shared scripts on the Register.
Please login to merge, or discard this patch.
src/Http/Router.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 	 *
72 72
 	 * @param string $vendor
73 73
 	 */
74
-	public function set_vendor( $vendor ) {
74
+	public function set_vendor($vendor) {
75 75
 		$this->vendor = $vendor;
76 76
 	}
77 77
 
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 	 *
81 81
 	 * @param int $version
82 82
 	 */
83
-	public function set_version( $version ) {
83
+	public function set_version($version) {
84 84
 		$this->version = $version;
85 85
 	}
86 86
 
@@ -94,15 +94,15 @@  discard block
 block discarded – undo
94 94
 	 * @throws VersionNotSetException
95 95
 	 */
96 96
 	public function register() {
97
-		if ( ! $this->vendor ) {
97
+		if (!$this->vendor) {
98 98
 			throw new VendorNotSetException;
99 99
 		}
100 100
 
101
-		if ( ! $this->version ) {
101
+		if (!$this->version) {
102 102
 			throw new VersionNotSetException;
103 103
 		}
104 104
 
105
-		foreach ( $this->endpoints as $endpoint ) {
105
+		foreach ($this->endpoints as $endpoint) {
106 106
 			register_rest_route(
107 107
 				$this->get_namespace(),
108 108
 				$endpoint->get_route(),
@@ -120,13 +120,13 @@  discard block
 block discarded – undo
120 120
 	 * @param array    $options
121 121
 	 * @param callable $callback
122 122
 	 */
123
-	public function group( array $options, $callback ) {
123
+	public function group(array $options, $callback) {
124 124
 		$router = new static;
125 125
 
126
-		call_user_func( $callback, $router );
126
+		call_user_func($callback, $router);
127 127
 
128
-		foreach ( $router->get_endpoints() as $endpoint ) {
129
-			$this->endpoints[] = $this->set_options( $endpoint, $options );
128
+		foreach ($router->get_endpoints() as $endpoint) {
129
+			$this->endpoints[] = $this->set_options($endpoint, $options);
130 130
 		}
131 131
 	}
132 132
 
@@ -145,26 +145,26 @@  discard block
 block discarded – undo
145 145
 	 * @throws MissingArgumentException
146 146
 	 * @throws InvalidArgumentException
147 147
 	 */
148
-	public function __call( $name, $arguments ) {
149
-		if ( ! in_array( $name, array_keys( $this->methods ) ) ) {
148
+	public function __call($name, $arguments) {
149
+		if (!in_array($name, array_keys($this->methods))) {
150 150
 			throw new UnknownMethodException;
151 151
 		}
152 152
 
153 153
 		// array_merge ensures we have 3 elements
154
-		list( $route, $callback, $options ) = array_merge( $arguments, array( null, null, null ) );
154
+		list($route, $callback, $options) = array_merge($arguments, array(null, null, null));
155 155
 
156
-		if ( ! $route || ! $callback ) {
156
+		if (!$route || !$callback) {
157 157
 			throw new MissingArgumentException;
158 158
 		}
159 159
 
160
-		if ( ! is_callable( $callback ) ) {
160
+		if (!is_callable($callback)) {
161 161
 			throw new InvalidArgumentException;
162 162
 		}
163 163
 
164
-		$endpoint = new Endpoint( $route, $this->methods[ $name ], $callback );
164
+		$endpoint = new Endpoint($route, $this->methods[$name], $callback);
165 165
 
166
-		if ( $options && is_array( $options ) ) {
167
-			$endpoint = $this->set_options( $endpoint, $options );
166
+		if ($options && is_array($options)) {
167
+			$endpoint = $this->set_options($endpoint, $options);
168 168
 		}
169 169
 
170 170
 		return $this->endpoints[] = $endpoint;
@@ -181,17 +181,17 @@  discard block
 block discarded – undo
181 181
 	 * @return Endpoint
182 182
 	 * @throws MalformedRouteException
183 183
 	 */
184
-	protected function set_options( Endpoint $endpoint, array $options ) {
185
-		if ( isset( $options['guard'] ) ) {
186
-			$endpoint->set_guard( $options['guard'] );
184
+	protected function set_options(Endpoint $endpoint, array $options) {
185
+		if (isset($options['guard'])) {
186
+			$endpoint->set_guard($options['guard']);
187 187
 		}
188 188
 
189
-		if ( isset( $options['filter'] ) ) {
190
-			$endpoint->set_filter( $options['filter'] );
189
+		if (isset($options['filter'])) {
190
+			$endpoint->set_filter($options['filter']);
191 191
 		}
192 192
 
193
-		if ( isset( $options['prefix'] ) ) {
194
-			$endpoint->set_prefix( $options['prefix'] );
193
+		if (isset($options['prefix'])) {
194
+			$endpoint->set_prefix($options['prefix']);
195 195
 		}
196 196
 
197 197
 		return $endpoint;
Please login to merge, or discard this patch.
src/Http/Endpoint.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -65,8 +65,8 @@  discard block
 block discarded – undo
65 65
 	 *
66 66
 	 * @throws MalformedRouteException
67 67
 	 */
68
-	public function __construct( $route, $method, $callback ) {
69
-		if ( ! Str::starts_with( $route, '/' ) || Str::ends_with( $route, '/' ) ) {
68
+	public function __construct($route, $method, $callback) {
69
+		if (!Str::starts_with($route, '/') || Str::ends_with($route, '/')) {
70 70
 			throw new MalformedRouteException;
71 71
 		}
72 72
 
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 	 * @return string
84 84
 	 */
85 85
 	public function get_route() {
86
-		return ( $this->prefix ?: '' ) . $this->route;
86
+		return ($this->prefix ?: '') . $this->route;
87 87
 	}
88 88
 
89 89
 	/**
@@ -97,11 +97,11 @@  discard block
 block discarded – undo
97 97
 			'callback' => $this->callback,
98 98
 		);
99 99
 
100
-		if ( $this->guard ) {
101
-			$options['permission_callback'] = array( $this->guard, 'authorized' );
100
+		if ($this->guard) {
101
+			$options['permission_callback'] = array($this->guard, 'authorized');
102 102
 		}
103 103
 
104
-		if ( $this->filter ) {
104
+		if ($this->filter) {
105 105
 			$options['args'] = $this->filter->rules();
106 106
 		}
107 107
 
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
 	 *
116 116
 	 * @return $this
117 117
 	 */
118
-	public function set_guard( GuardContract $guard ) {
118
+	public function set_guard(GuardContract $guard) {
119 119
 		$this->guard = $guard;
120 120
 
121 121
 		return $this;
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 	 *
129 129
 	 * @return $this
130 130
 	 */
131
-	public function set_filter( FilterContract $filter ) {
131
+	public function set_filter(FilterContract $filter) {
132 132
 		$this->filter = $filter;
133 133
 
134 134
 		return $this;
@@ -142,8 +142,8 @@  discard block
 block discarded – undo
142 142
 	 * @return $this
143 143
 	 * @throws MalformedRouteException
144 144
 	 */
145
-	public function set_prefix( $prefix ) {
146
-		if ( ! Str::starts_with( $prefix, '/' ) || Str::ends_with( $prefix, '/' ) ) {
145
+	public function set_prefix($prefix) {
146
+		if (!Str::starts_with($prefix, '/') || Str::ends_with($prefix, '/')) {
147 147
 			throw new MalformedRouteException;
148 148
 		}
149 149
 
Please login to merge, or discard this patch.
src/Axolotl/Model.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -825,7 +825,7 @@
 block discarded – undo
825 825
 	 * @param string $type
826 826
 	 * @param string $local_key
827 827
 	 *
828
-	 * @return HasMany
828
+	 * @return BelongsToOne
829 829
 	 */
830 830
 	protected function belongs_to_one( $class, $type, $local_key = '' ) {
831 831
 		return new BelongsToOne( $this, $class, $type, $local_key );
Please login to merge, or discard this patch.
Spacing   +128 added lines, -128 removed lines patch added patch discarded remove patch
@@ -113,15 +113,15 @@  discard block
 block discarded – undo
113 113
 	 *
114 114
 	 * @param array <string, mixed> $attributes
115 115
 	 */
116
-	public function __construct( array $attributes = array() ) {
116
+	public function __construct(array $attributes = array()) {
117 117
 		$this->maybe_boot();
118 118
 		$this->sync_original();
119 119
 
120
-		if ( $this->uses_wp_object() ) {
120
+		if ($this->uses_wp_object()) {
121 121
 			$this->create_wp_object();
122 122
 		}
123 123
 
124
-		$this->refresh( $attributes );
124
+		$this->refresh($attributes);
125 125
 	}
126 126
 
127 127
 	/**
@@ -134,10 +134,10 @@  discard block
 block discarded – undo
134 134
 	 *
135 135
 	 * @return $this
136 136
 	 */
137
-	public function refresh( array $attributes ) {
137
+	public function refresh(array $attributes) {
138 138
 		$this->clear();
139 139
 
140
-		return $this->merge( $attributes );
140
+		return $this->merge($attributes);
141 141
 	}
142 142
 
143 143
 	/**
@@ -149,9 +149,9 @@  discard block
 block discarded – undo
149 149
 	 *
150 150
 	 * @return $this
151 151
 	 */
152
-	public function merge( array $attributes ) {
153
-		foreach ( $attributes as $name => $value ) {
154
-			$this->set_attribute( $name, $value );
152
+	public function merge(array $attributes) {
153
+		foreach ($attributes as $name => $value) {
154
+			$this->set_attribute($name, $value);
155 155
 		}
156 156
 
157 157
 		return $this;
@@ -188,11 +188,11 @@  discard block
 block discarded – undo
188 188
 	public function get_changed_table_attributes() {
189 189
 		$changed = array();
190 190
 
191
-		foreach ( $this->get_table_attributes() as $attribute ) {
192
-			if ( $this->get_attribute( $attribute ) !==
193
-			     $this->get_original_attribute( $attribute )
191
+		foreach ($this->get_table_attributes() as $attribute) {
192
+			if ($this->get_attribute($attribute) !==
193
+			     $this->get_original_attribute($attribute)
194 194
 			) {
195
-				$changed[ $attribute ] = $this->get_attribute( $attribute );
195
+				$changed[$attribute] = $this->get_attribute($attribute);
196 196
 			}
197 197
 		}
198 198
 
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
 	 * @return false|WP_Post|WP_Term
209 209
 	 */
210 210
 	public function get_underlying_wp_object() {
211
-		if ( isset( $this->attributes['object'] ) ) {
211
+		if (isset($this->attributes['object'])) {
212 212
 			return $this->attributes['object'];
213 213
 		}
214 214
 
@@ -234,11 +234,11 @@  discard block
 block discarded – undo
234 234
 	public function get_changed_wp_object_attributes() {
235 235
 		$changed = array();
236 236
 
237
-		foreach ( $this->get_wp_object_keys() as $key ) {
238
-			if ( $this->get_attribute( $key ) !==
239
-			     $this->get_original_attribute( $key )
237
+		foreach ($this->get_wp_object_keys() as $key) {
238
+			if ($this->get_attribute($key) !==
239
+			     $this->get_original_attribute($key)
240 240
 			) {
241
-				$changed[ $key ] = $this->get_attribute( $key );
241
+				$changed[$key] = $this->get_attribute($key);
242 242
 			}
243 243
 		}
244 244
 
@@ -253,8 +253,8 @@  discard block
 block discarded – undo
253 253
 	 * @param string $name
254 254
 	 * @param mixed  $value
255 255
 	 */
256
-	public function __set( $name, $value ) {
257
-		$this->set_attribute( $name, $value );
256
+	public function __set($name, $value) {
257
+		$this->set_attribute($name, $value);
258 258
 	}
259 259
 
260 260
 	/**
@@ -271,19 +271,19 @@  discard block
 block discarded – undo
271 271
 	 *
272 272
 	 * @throws GuardedPropertyException
273 273
 	 */
274
-	public function set_attribute( $name, $value ) {
275
-		if ( 'object' === $name ) {
276
-			return $this->override_wp_object( $value );
274
+	public function set_attribute($name, $value) {
275
+		if ('object' === $name) {
276
+			return $this->override_wp_object($value);
277 277
 		}
278 278
 
279
-		if ( ! $this->is_fillable( $name ) ) {
279
+		if (!$this->is_fillable($name)) {
280 280
 			throw new GuardedPropertyException;
281 281
 		}
282 282
 
283
-		if ( $method = $this->has_map_method( $name ) ) {
283
+		if ($method = $this->has_map_method($name)) {
284 284
 			$this->attributes['object']->{$this->{$method}()} = $value;
285 285
 		} else {
286
-			$this->attributes['table'][ $name ] = $value;
286
+			$this->attributes['table'][$name] = $value;
287 287
 		}
288 288
 
289 289
 		return $this;
@@ -295,11 +295,11 @@  discard block
 block discarded – undo
295 295
 	 * @return array
296 296
 	 */
297 297
 	public function get_attribute_keys() {
298
-		if ( isset( self::$memo[ get_called_class() ][ __METHOD__ ] ) ) {
299
-			return self::$memo[ get_called_class() ][ __METHOD__ ];
298
+		if (isset(self::$memo[get_called_class()][__METHOD__])) {
299
+			return self::$memo[get_called_class()][__METHOD__];
300 300
 		}
301 301
 
302
-		return self::$memo[ get_called_class() ][ __METHOD__ ]
302
+		return self::$memo[get_called_class()][__METHOD__]
303 303
 			= array_merge(
304 304
 				$this->fillable,
305 305
 				$this->guarded,
@@ -314,22 +314,22 @@  discard block
 block discarded – undo
314 314
 	 * @return array
315 315
 	 */
316 316
 	public function get_table_keys() {
317
-		if ( isset( self::$memo[ get_called_class() ][ __METHOD__ ] ) ) {
318
-			return self::$memo[ get_called_class() ][ __METHOD__ ];
317
+		if (isset(self::$memo[get_called_class()][__METHOD__])) {
318
+			return self::$memo[get_called_class()][__METHOD__];
319 319
 		}
320 320
 
321 321
 		$keys = array();
322 322
 
323
-		foreach ( $this->get_attribute_keys() as $key ) {
324
-			if ( ! $this->has_map_method( $key ) &&
325
-			     ! $this->has_compute_method( $key ) &&
326
-			     ! $this->has_related_method( $key )
323
+		foreach ($this->get_attribute_keys() as $key) {
324
+			if (!$this->has_map_method($key) &&
325
+			     !$this->has_compute_method($key) &&
326
+			     !$this->has_related_method($key)
327 327
 			) {
328 328
 				$keys[] = $key;
329 329
 			}
330 330
 		}
331 331
 
332
-		return self::$memo[ get_called_class() ][ __METHOD__ ] = $keys;
332
+		return self::$memo[get_called_class()][__METHOD__] = $keys;
333 333
 	}
334 334
 
335 335
 	/**
@@ -338,19 +338,19 @@  discard block
 block discarded – undo
338 338
 	 * @return array
339 339
 	 */
340 340
 	public function get_wp_object_keys() {
341
-		if ( isset( self::$memo[ get_called_class() ][ __METHOD__ ] ) ) {
342
-			return self::$memo[ get_called_class() ][ __METHOD__ ];
341
+		if (isset(self::$memo[get_called_class()][__METHOD__])) {
342
+			return self::$memo[get_called_class()][__METHOD__];
343 343
 		}
344 344
 
345 345
 		$keys = array();
346 346
 
347
-		foreach ( $this->get_attribute_keys() as $key ) {
348
-			if ( $this->has_map_method( $key ) ) {
347
+		foreach ($this->get_attribute_keys() as $key) {
348
+			if ($this->has_map_method($key)) {
349 349
 				$keys[] = $key;
350 350
 			}
351 351
 		}
352 352
 
353
-		return self::$memo[ get_called_class() ][ __METHOD__ ] = $keys;
353
+		return self::$memo[get_called_class()][__METHOD__] = $keys;
354 354
 	}
355 355
 
356 356
 	/**
@@ -359,19 +359,19 @@  discard block
 block discarded – undo
359 359
 	 * @return array
360 360
 	 */
361 361
 	public function get_computed_keys() {
362
-		if ( isset( self::$memo[ get_called_class() ][ __METHOD__ ] ) ) {
363
-			return self::$memo[ get_called_class() ][ __METHOD__ ];
362
+		if (isset(self::$memo[get_called_class()][__METHOD__])) {
363
+			return self::$memo[get_called_class()][__METHOD__];
364 364
 		}
365 365
 
366 366
 		$keys = array();
367 367
 
368
-		foreach ( $this->get_attribute_keys() as $key ) {
369
-			if ( $this->has_compute_method( $key ) ) {
368
+		foreach ($this->get_attribute_keys() as $key) {
369
+			if ($this->has_compute_method($key)) {
370 370
 				$keys[] = $key;
371 371
 			}
372 372
 		}
373 373
 
374
-		return self::$memo[ get_called_class() ][ __METHOD__ ] = $keys;
374
+		return self::$memo[get_called_class()][__METHOD__] = $keys;
375 375
 	}
376 376
 
377 377
 	/**
@@ -380,19 +380,19 @@  discard block
 block discarded – undo
380 380
 	 * @return array
381 381
 	 */
382 382
 	public function get_related_keys() {
383
-		if ( isset( self::$memo[ get_called_class() ][ __METHOD__ ] ) ) {
384
-			return self::$memo[ get_called_class() ][ __METHOD__ ];
383
+		if (isset(self::$memo[get_called_class()][__METHOD__])) {
384
+			return self::$memo[get_called_class()][__METHOD__];
385 385
 		}
386 386
 
387 387
 		$keys = array();
388 388
 
389
-		foreach ( $this->get_attribute_keys() as $key ) {
390
-			if ( $this->has_related_method( $key ) ) {
389
+		foreach ($this->get_attribute_keys() as $key) {
390
+			if ($this->has_related_method($key)) {
391 391
 				$keys[] = $key;
392 392
 			}
393 393
 		}
394 394
 
395
-		return self::$memo[ get_called_class() ][ __METHOD__ ] = $keys;
395
+		return self::$memo[get_called_class()][__METHOD__] = $keys;
396 396
 	}
397 397
 
398 398
 	/**
@@ -403,32 +403,32 @@  discard block
 block discarded – undo
403 403
 	public function serialize() {
404 404
 		$attributes = array();
405 405
 
406
-		if ( $this->visible ) {
406
+		if ($this->visible) {
407 407
 			// If visible attributes are set, we'll only reveal those.
408
-			foreach ( $this->visible as $key ) {
409
-				$attributes[ $key ] = $this->get_attribute( $key );
408
+			foreach ($this->visible as $key) {
409
+				$attributes[$key] = $this->get_attribute($key);
410 410
 			}
411
-		} elseif ( $this->hidden ) {
411
+		} elseif ($this->hidden) {
412 412
 			// If hidden attributes are set, we'll grab everything and hide those.
413
-			foreach ( $this->get_attribute_keys() as $key ) {
414
-				if ( ! in_array( $key, $this->hidden ) ) {
415
-					$attributes[ $key ] = $this->get_attribute( $key );
413
+			foreach ($this->get_attribute_keys() as $key) {
414
+				if (!in_array($key, $this->hidden)) {
415
+					$attributes[$key] = $this->get_attribute($key);
416 416
 				}
417 417
 			}
418 418
 		} else {
419 419
 			// If nothing is hidden/visible, we'll grab and reveal everything.
420
-			foreach ( $this->get_attribute_keys() as $key ) {
421
-				$attributes[ $key ] = $this->get_attribute( $key );
420
+			foreach ($this->get_attribute_keys() as $key) {
421
+				$attributes[$key] = $this->get_attribute($key);
422 422
 			}
423 423
 		}
424 424
 
425
-		return array_map( function ( $attribute ) {
426
-			if ( $attribute instanceof Serializes ) {
425
+		return array_map(function($attribute) {
426
+			if ($attribute instanceof Serializes) {
427 427
 				return $attribute->serialize();
428 428
 			}
429 429
 
430 430
 			return $attribute;
431
-		}, $attributes );
431
+		}, $attributes);
432 432
 	}
433 433
 
434 434
 	/**
@@ -439,7 +439,7 @@  discard block
 block discarded – undo
439 439
 	public function sync_original() {
440 440
 		$this->original = $this->attributes;
441 441
 
442
-		if ( $this->attributes['object'] ) {
442
+		if ($this->attributes['object']) {
443 443
 			$this->original['object'] = clone $this->attributes['object'];
444 444
 		}
445 445
 
@@ -455,24 +455,24 @@  discard block
 block discarded – undo
455 455
 	 *
456 456
 	 * @return bool
457 457
 	 */
458
-	private function is_fillable( $name ) {
458
+	private function is_fillable($name) {
459 459
 		// If this model isn't guarded, everything is fillable.
460
-		if ( ! $this->is_guarded ) {
460
+		if (!$this->is_guarded) {
461 461
 			return true;
462 462
 		}
463 463
 
464 464
 		// If it's in the fillable array, then it's fillable.
465
-		if ( in_array( $name, $this->fillable ) ) {
465
+		if (in_array($name, $this->fillable)) {
466 466
 			return true;
467 467
 		}
468 468
 
469 469
 		// If it's explicitly guarded, then it's not fillable.
470
-		if ( in_array( $name, $this->guarded ) ) {
470
+		if (in_array($name, $this->guarded)) {
471 471
 			return false;
472 472
 		}
473 473
 
474 474
 		// If fillable hasn't been defined, then everything else fillable.
475
-		return ! $this->fillable;
475
+		return !$this->fillable;
476 476
 	}
477 477
 
478 478
 	/**
@@ -484,8 +484,8 @@  discard block
 block discarded – undo
484 484
 	 *
485 485
 	 * @return $this
486 486
 	 */
487
-	private function override_wp_object( $value ) {
488
-		$this->attributes['object'] = $this->set_wp_object_constants( $value );
487
+	private function override_wp_object($value) {
488
+		$this->attributes['object'] = $this->set_wp_object_constants($value);
489 489
 
490 490
 		return $this;
491 491
 	}
@@ -499,19 +499,19 @@  discard block
 block discarded – undo
499 499
 	 * @throws LogicException
500 500
 	 */
501 501
 	private function create_wp_object() {
502
-		switch ( true ) {
502
+		switch (true) {
503 503
 			case $this instanceof UsesWordPressPost:
504
-				$object = new WP_Post( (object) array() );
504
+				$object = new WP_Post((object) array());
505 505
 				break;
506 506
 			case $this instanceof UsesWordPressTerm:
507
-				$object = new WP_Term( (object) array() );
507
+				$object = new WP_Term((object) array());
508 508
 				break;
509 509
 			default:
510 510
 				throw new LogicException;
511 511
 				break;
512 512
 		}
513 513
 
514
-		$this->attributes['object'] = $this->set_wp_object_constants( $object );
514
+		$this->attributes['object'] = $this->set_wp_object_constants($object);
515 515
 	}
516 516
 
517 517
 	/**
@@ -525,12 +525,12 @@  discard block
 block discarded – undo
525 525
 	 *
526 526
 	 * @return object
527 527
 	 */
528
-	protected function set_wp_object_constants( $object ) {
529
-		if ( $this instanceof UsesWordPressPost ) {
528
+	protected function set_wp_object_constants($object) {
529
+		if ($this instanceof UsesWordPressPost) {
530 530
 			$object->post_type = $this::get_post_type();
531 531
 		}
532 532
 
533
-		if ( $this instanceof UsesWordPressTerm ) {
533
+		if ($this instanceof UsesWordPressTerm) {
534 534
 			$object->taxonomy = $this::get_taxonomy();
535 535
 		}
536 536
 
@@ -546,8 +546,8 @@  discard block
 block discarded – undo
546 546
 	 *
547 547
 	 * @return mixed
548 548
 	 */
549
-	public function __get( $name ) {
550
-		return $this->get_attribute( $name );
549
+	public function __get($name) {
550
+		return $this->get_attribute($name);
551 551
 	}
552 552
 
553 553
 	/**
@@ -559,19 +559,19 @@  discard block
 block discarded – undo
559 559
 	 *
560 560
 	 * @throws PropertyDoesNotExistException If property isn't found.
561 561
 	 */
562
-	public function get_attribute( $name ) {
563
-		if ( $method = $this->has_map_method( $name ) ) {
562
+	public function get_attribute($name) {
563
+		if ($method = $this->has_map_method($name)) {
564 564
 			$value = $this->attributes['object']->{$this->{$method}()};
565
-		} elseif ( $method = $this->has_compute_method( $name ) ) {
565
+		} elseif ($method = $this->has_compute_method($name)) {
566 566
 			$value = $this->{$method}();
567
-		} else if ( $method = $this->has_related_method( $name ) ) {
568
-			$value = $this->get_related( $this->{$method}()->get_sha() );
567
+		} else if ($method = $this->has_related_method($name)) {
568
+			$value = $this->get_related($this->{$method}()->get_sha());
569 569
 		} else {
570
-			if ( ! isset( $this->attributes['table'][ $name ] ) ) {
570
+			if (!isset($this->attributes['table'][$name])) {
571 571
 				throw new PropertyDoesNotExistException;
572 572
 			}
573 573
 
574
-			$value = $this->attributes['table'][ $name ];
574
+			$value = $this->attributes['table'][$name];
575 575
 		}
576 576
 
577 577
 		return $value;
@@ -586,10 +586,10 @@  discard block
 block discarded – undo
586 586
 	 *
587 587
 	 * @throws PropertyDoesNotExistException If property isn't found.
588 588
 	 */
589
-	public function get_original_attribute( $name ) {
590
-		$original = new static( $this->original );
589
+	public function get_original_attribute($name) {
590
+		$original = new static($this->original);
591 591
 
592
-		return $original->get_attribute( $name );
592
+		return $original->get_attribute($name);
593 593
 	}
594 594
 
595 595
 	/**
@@ -601,11 +601,11 @@  discard block
 block discarded – undo
601 601
 	 * @throws LogicException
602 602
 	 */
603 603
 	public function get_primary_id() {
604
-		if ( $this instanceof UsesWordPressPost ) {
604
+		if ($this instanceof UsesWordPressPost) {
605 605
 			return $this->get_underlying_wp_object()->ID;
606 606
 		}
607 607
 
608
-		if ( $this instanceof UsesWordPressTerm ) {
608
+		if ($this instanceof UsesWordPressTerm) {
609 609
 			return $this->get_underlying_wp_object()->term_id;
610 610
 		}
611 611
 
@@ -622,7 +622,7 @@  discard block
 block discarded – undo
622 622
 	 * @throws LogicException
623 623
 	 */
624 624
 	public function get_foreign_key() {
625
-		if ( $this instanceof UsesWordPressPost ) {
625
+		if ($this instanceof UsesWordPressPost) {
626 626
 			return 'post_id';
627 627
 		}
628 628
 
@@ -637,8 +637,8 @@  discard block
 block discarded – undo
637 637
 	 *
638 638
 	 * @return Model|Collection
639 639
 	 */
640
-	public function get_related( $sha ) {
641
-		return $this->related[ $sha ];
640
+	public function get_related($sha) {
641
+		return $this->related[$sha];
642 642
 	}
643 643
 
644 644
 	/**
@@ -649,12 +649,12 @@  discard block
 block discarded – undo
649 649
 	 *
650 650
 	 * @throws RuntimeException
651 651
 	 */
652
-	public function set_related( $sha, $target ) {
653
-		if ( ! ( $target instanceof Model ) && ! ( $target instanceof Collection ) ) {
652
+	public function set_related($sha, $target) {
653
+		if (!($target instanceof Model) && !($target instanceof Collection)) {
654 654
 			throw new RuntimeException;
655 655
 		}
656 656
 
657
-		$this->related[ $sha ] = $target;
657
+		$this->related[$sha] = $target;
658 658
 	}
659 659
 
660 660
 	/**
@@ -668,8 +668,8 @@  discard block
 block discarded – undo
668 668
 	 *
669 669
 	 * @return false|string
670 670
 	 */
671
-	protected function has_map_method( $name ) {
672
-		if ( method_exists( $this, $method = "map_{$name}" ) ) {
671
+	protected function has_map_method($name) {
672
+		if (method_exists($this, $method = "map_{$name}")) {
673 673
 			return $method;
674 674
 		}
675 675
 
@@ -686,8 +686,8 @@  discard block
 block discarded – undo
686 686
 	 *
687 687
 	 * @return false|string
688 688
 	 */
689
-	protected function has_compute_method( $name ) {
690
-		if ( method_exists( $this, $method = "compute_{$name}" ) ) {
689
+	protected function has_compute_method($name) {
690
+		if (method_exists($this, $method = "compute_{$name}")) {
691 691
 			return $method;
692 692
 		}
693 693
 
@@ -704,8 +704,8 @@  discard block
 block discarded – undo
704 704
 	 *
705 705
 	 * @return false|string
706 706
 	 */
707
-	protected function has_related_method( $name ) {
708
-		if ( method_exists( $this, $method = "related_{$name}" ) ) {
707
+	protected function has_related_method($name) {
708
+		if (method_exists($this, $method = "related_{$name}")) {
709 709
 			return $method;
710 710
 		}
711 711
 
@@ -723,10 +723,10 @@  discard block
 block discarded – undo
723 723
 	public function clear() {
724 724
 		$keys = $this->get_attribute_keys();
725 725
 
726
-		foreach ( $keys as $key ) {
726
+		foreach ($keys as $key) {
727 727
 			try {
728
-				$this->set_attribute( $key, null );
729
-			} catch ( GuardedPropertyException $e ) {
728
+				$this->set_attribute($key, null);
729
+			} catch (GuardedPropertyException $e) {
730 730
 				// We won't clear out guarded attributes.
731 731
 			}
732 732
 		}
@@ -760,13 +760,13 @@  discard block
 block discarded – undo
760 760
 	 * @return array
761 761
 	 */
762 762
 	protected function get_compute_methods() {
763
-		$methods = get_class_methods( get_called_class() );
764
-		$methods = array_filter( $methods, function ( $method ) {
765
-			return strrpos( $method, 'compute_', - strlen( $method ) ) !== false;
763
+		$methods = get_class_methods(get_called_class());
764
+		$methods = array_filter($methods, function($method) {
765
+			return strrpos($method, 'compute_', - strlen($method)) !== false;
766 766
 		} );
767
-		$methods = array_map( function ( $method ) {
768
-			return substr( $method, strlen( 'compute_' ) );
769
-		}, $methods );
767
+		$methods = array_map(function($method) {
768
+			return substr($method, strlen('compute_'));
769
+		}, $methods);
770 770
 
771 771
 		return $methods;
772 772
 	}
@@ -777,13 +777,13 @@  discard block
 block discarded – undo
777 777
 	 * @return array
778 778
 	 */
779 779
 	protected function get_related_methods() {
780
-		$methods = get_class_methods( get_called_class() );
781
-		$methods = array_filter( $methods, function ( $method ) {
782
-			return strrpos( $method, 'related_', - strlen( $method ) ) !== false;
780
+		$methods = get_class_methods(get_called_class());
781
+		$methods = array_filter($methods, function($method) {
782
+			return strrpos($method, 'related_', - strlen($method)) !== false;
783 783
 		} );
784
-		$methods = array_map( function ( $method ) {
785
-			return substr( $method, strlen( 'related_' ) );
786
-		}, $methods );
784
+		$methods = array_map(function($method) {
785
+			return substr($method, strlen('related_'));
786
+		}, $methods);
787 787
 
788 788
 		return $methods;
789 789
 	}
@@ -795,12 +795,12 @@  discard block
 block discarded – undo
795 795
 	 *
796 796
 	 * @return bool
797 797
 	 */
798
-	public function relation_is_filled( $relation ) {
798
+	public function relation_is_filled($relation) {
799 799
 		$sha = $this
800
-			->{$this->has_related_method( $relation )}()
800
+			->{$this->has_related_method($relation)}()
801 801
 			->get_sha();
802 802
 
803
-		return isset( $this->related[ $sha ] );
803
+		return isset($this->related[$sha]);
804 804
 	}
805 805
 
806 806
 	/**
@@ -818,7 +818,7 @@  discard block
 block discarded – undo
818 818
 	 *
819 819
 	 * @param bool $is_filling
820 820
 	 */
821
-	public function set_filling( $is_filling ) {
821
+	public function set_filling($is_filling) {
822 822
 		$this->filling = $is_filling;
823 823
 	}
824 824
 
@@ -831,8 +831,8 @@  discard block
 block discarded – undo
831 831
 	 *
832 832
 	 * @return HasMany
833 833
 	 */
834
-	protected function has_many( $class, $type, $foreign_key ) {
835
-		return new HasMany( $this, $class, $type, $foreign_key );
834
+	protected function has_many($class, $type, $foreign_key) {
835
+		return new HasMany($this, $class, $type, $foreign_key);
836 836
 	}
837 837
 
838 838
 	/**
@@ -844,16 +844,16 @@  discard block
 block discarded – undo
844 844
 	 *
845 845
 	 * @return HasMany
846 846
 	 */
847
-	protected function belongs_to_one( $class, $type, $local_key = '' ) {
848
-		return new BelongsToOne( $this, $class, $type, $local_key );
847
+	protected function belongs_to_one($class, $type, $local_key = '') {
848
+		return new BelongsToOne($this, $class, $type, $local_key);
849 849
 	}
850 850
 
851 851
 	/**
852 852
 	 * Sets up the memo array for the creating model.
853 853
 	 */
854 854
 	private function maybe_boot() {
855
-		if ( ! isset( self::$memo[ get_called_class() ] ) ) {
856
-			self::$memo[ get_called_class() ] = array();
855
+		if (!isset(self::$memo[get_called_class()])) {
856
+			self::$memo[get_called_class()] = array();
857 857
 		}
858 858
 	}
859 859
 
Please login to merge, or discard this patch.
src/Axolotl/Relationship/BelongsToOne.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -90,7 +90,7 @@
 block discarded – undo
90 90
 	/**
91 91
 	 * Gets the ID value for the target model to search by.
92 92
 	 *
93
-	 * @return int|false
93
+	 * @return integer
94 94
 	 *
95 95
 	 * @throws LogicException
96 96
 	 */
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -29,10 +29,10 @@  discard block
 block discarded – undo
29 29
 	 * @param string $type
30 30
 	 * @param string $local_key
31 31
 	 */
32
-	public function __construct( Model $model, $class, $type, $local_key ) {
32
+	public function __construct(Model $model, $class, $type, $local_key) {
33 33
 		$this->local_key = $local_key;
34 34
 
35
-		parent::__construct( $model, $class, $type );
35
+		parent::__construct($model, $class, $type);
36 36
 	}
37 37
 
38 38
 	/**
@@ -42,25 +42,25 @@  discard block
 block discarded – undo
42 42
 	 *
43 43
 	 * @throws LogicException
44 44
 	 */
45
-	public function attach_relation( EntityManager $database ) {
46
-		if ( $this->get_model()->is_filling() ) {
45
+	public function attach_relation(EntityManager $database) {
46
+		if ($this->get_model()->is_filling()) {
47 47
 			return;
48 48
 		}
49 49
 
50
-		$this->get_model()->set_filling( true );
50
+		$this->get_model()->set_filling(true);
51 51
 
52 52
 		$id = $this->make_target_id();
53 53
 
54
-		if ( $id ) {
54
+		if ($id) {
55 55
 			$target = $database->find(
56 56
 				$this->get_class(),
57 57
 				$id
58 58
 			);
59 59
 
60
-			$this->set_target( $target );
60
+			$this->set_target($target);
61 61
 		}
62 62
 
63
-		$this->get_model()->set_filling( false );
63
+		$this->get_model()->set_filling(false);
64 64
 	}
65 65
 
66 66
 	/**
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 	public function get_sha() {
72 72
 		return sha1(
73 73
 			__CLASS__ .
74
-			get_class( $this->model ) .
74
+			get_class($this->model) .
75 75
 			$this->class .
76 76
 			$this->type .
77 77
 			$this->local_key
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 	protected function make_target_id() {
98 98
 		$class = $this->get_class();
99 99
 
100
-		switch ( $this->get_relationship_type() ) {
100
+		switch ($this->get_relationship_type()) {
101 101
 			case 'post_post':
102 102
 				return $this->get_model()
103 103
 					->get_underlying_wp_object()
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 					$class::get_taxonomy()
111 111
 				);
112 112
 
113
-				if ( ! $terms || is_wp_error( $terms ) ) {
113
+				if (!$terms || is_wp_error($terms)) {
114 114
 					return false;
115 115
 				}
116 116
 
Please login to merge, or discard this patch.
src/Axolotl/Repository/AbstractRepository.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -159,7 +159,7 @@
 block discarded – undo
159 159
 	/**
160 160
 	 * Fills the provided Model with attributes from its custom table.
161 161
 	 *
162
-	 * @param Model|UsesCustomTable $model
162
+	 * @param Model $model
163 163
 	 */
164 164
 	protected function fill_table_attrs_from_table( Model $model ) {
165 165
 		$sql[] = "SELECT * FROM {$this->make_table_name( $model )}";
Please login to merge, or discard this patch.
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -39,9 +39,9 @@  discard block
 block discarded – undo
39 39
 	 *
40 40
 	 * @return bool
41 41
 	 */
42
-	protected static function get_found( $class, $id ) {
43
-		if ( isset( self::$found[ $class ][ $id ] ) ) {
44
-			return self::$found[ $class ][ $id ];
42
+	protected static function get_found($class, $id) {
43
+		if (isset(self::$found[$class][$id])) {
44
+			return self::$found[$class][$id];
45 45
 		}
46 46
 
47 47
 		return false;
@@ -88,15 +88,15 @@  discard block
 block discarded – undo
88 88
 	 * @param EntityManager $database
89 89
 	 * @param string        $class
90 90
 	 */
91
-	public function __construct( EntityManager $database, $class ) {
91
+	public function __construct(EntityManager $database, $class) {
92 92
 		$this->database = $database;
93 93
 		$this->class    = $class;
94 94
 		$this->prefix   = $database->get_prefix();
95 95
 		$this->main     = $database->get_main_query();
96 96
 		$this->wpdb     = $database->get_wpdb();
97 97
 
98
-		if ( ! isset( self::$found[ $class ] ) ) {
99
-			self::$found[ $class ] = array();
98
+		if (!isset(self::$found[$class])) {
99
+			self::$found[$class] = array();
100 100
 		}
101 101
 	}
102 102
 
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 	 *
108 108
 	 * @return Model|WP_Error
109 109
 	 */
110
-	abstract public function find( $id );
110
+	abstract public function find($id);
111 111
 
112 112
 	/**
113 113
 	 * Finds all the models of the repository class for the given params.
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 	 *
117 117
 	 * @return Collection|WP_Error
118 118
 	 */
119
-	abstract public function find_by( array $params = array() );
119
+	abstract public function find_by(array $params = array());
120 120
 
121 121
 	/**
122 122
 	 * Create and saves a new model of the repository class
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 	 *
127 127
 	 * @return Model|WP_Error
128 128
 	 */
129
-	abstract public function create( array $data = array() );
129
+	abstract public function create(array $data = array());
130 130
 
131 131
 	/**
132 132
 	 * Updates a model with its latest data.
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
 	 *
136 136
 	 * @return Model|WP_Error
137 137
 	 */
138
-	abstract public function persist( Model $model );
138
+	abstract public function persist(Model $model);
139 139
 
140 140
 	/**
141 141
 	 * Delete the provided Model.
@@ -145,15 +145,15 @@  discard block
 block discarded – undo
145 145
 	 *
146 146
 	 * @return Model|WP_Error
147 147
 	 */
148
-	abstract public function delete( Model $model, $force = false );
148
+	abstract public function delete(Model $model, $force = false);
149 149
 
150 150
 	/**
151 151
 	 * Registers the found Model with the EntityManager.
152 152
 	 *
153 153
 	 * @param Model $model
154 154
 	 */
155
-	public function register_model( Model $model ) {
156
-		self::$found[ $this->class ][ $model->get_primary_id() ] = $model;
155
+	public function register_model(Model $model) {
156
+		self::$found[$this->class][$model->get_primary_id()] = $model;
157 157
 	}
158 158
 
159 159
 	/**
@@ -161,21 +161,21 @@  discard block
 block discarded – undo
161 161
 	 *
162 162
 	 * @param Model|UsesCustomTable $model
163 163
 	 */
164
-	protected function fill_table_attrs_from_table( Model $model ) {
165
-		$sql[] = "SELECT * FROM {$this->make_table_name( $model )}";
164
+	protected function fill_table_attrs_from_table(Model $model) {
165
+		$sql[] = "SELECT * FROM {$this->make_table_name($model)}";
166 166
 		$sql[] = "WHERE {$model->get_foreign_key()} = %d";
167 167
 
168 168
 		$sql = $this->wpdb->prepare(
169
-			implode( ' ', $sql ),
169
+			implode(' ', $sql),
170 170
 			$model->get_primary_id()
171 171
 		);
172 172
 
173
-		$row = $this->wpdb->get_row( $sql, ARRAY_A );
173
+		$row = $this->wpdb->get_row($sql, ARRAY_A);
174 174
 
175 175
 		$model->unguard();
176 176
 
177
-		foreach ( $row as $key => $value ) {
178
-			$model->set_attribute( $key, $value );
177
+		foreach ($row as $key => $value) {
178
+			$model->set_attribute($key, $value);
179 179
 		}
180 180
 
181 181
 		$model->reguard();
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
 	 *
189 189
 	 * @throws LogicException
190 190
 	 */
191
-	protected function save_table_attributes_to_table( Model $model ) {
191
+	protected function save_table_attributes_to_table(Model $model) {
192 192
 		throw new LogicException;
193 193
 	}
194 194
 
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
 	 *
200 200
 	 * @throws LogicException
201 201
 	 */
202
-	protected function delete_table_attributes_from_table( Model $model ) {
202
+	protected function delete_table_attributes_from_table(Model $model) {
203 203
 		throw new LogicException;
204 204
 	}
205 205
 
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
 	 *
211 211
 	 * @return string
212 212
 	 */
213
-	protected function make_table_name( UsesCustomTable $model ) {
213
+	protected function make_table_name(UsesCustomTable $model) {
214 214
 		return "{$this->wpdb->prefix}{$this->prefix}_{$model::get_table_name()}";
215 215
 	}
216 216
 }
Please login to merge, or discard this patch.
src/Axolotl/Repository/AbstractWordPress.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -239,7 +239,7 @@
 block discarded – undo
239 239
 	 *
240 240
 	 * @param Model $model
241 241
 	 *
242
-	 * @return int|WP_Error
242
+	 * @return integer
243 243
 	 */
244 244
 	abstract protected function save_wp_object( Model $model );
245 245
 
Please login to merge, or discard this patch.
Spacing   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -21,21 +21,21 @@  discard block
 block discarded – undo
21 21
 	 *
22 22
 	 * @param int $id
23 23
 	 */
24
-	public function find( $id ) {
25
-		if ( $model = self::get_found( $this->class, $id ) ) {
24
+	public function find($id) {
25
+		if ($model = self::get_found($this->class, $id)) {
26 26
 			return $model;
27 27
 		}
28 28
 
29
-		$object = $this->get_wp_object_by_id( $id );
29
+		$object = $this->get_wp_object_by_id($id);
30 30
 
31
-		if ( ! $object ) {
31
+		if (!$object) {
32 32
 			return new WP_Error(
33 33
 				'not_found',
34
-				__( 'Entity not found', 'jaxion' )
34
+				__('Entity not found', 'jaxion')
35 35
 			);
36 36
 		}
37 37
 
38
-		return $this->make_model_from_wp_object( $object );
38
+		return $this->make_model_from_wp_object($object);
39 39
 	}
40 40
 
41 41
 	/**
@@ -45,15 +45,15 @@  discard block
 block discarded – undo
45 45
 	 *
46 46
 	 * @return Collection
47 47
 	 */
48
-	public function find_by( array $params = array() ) {
48
+	public function find_by(array $params = array()) {
49 49
 		$collection = new Collection(
50 50
 			array(),
51
-			array( 'model' => $this->class )
51
+			array('model' => $this->class)
52 52
 		);
53 53
 
54
-		foreach ( $this->get_wp_objects_by_params( $params ) as $object ) {
54
+		foreach ($this->get_wp_objects_by_params($params) as $object) {
55 55
 			$collection->add(
56
-				$this->make_model_from_wp_object( $object )
56
+				$this->make_model_from_wp_object($object)
57 57
 			);
58 58
 		}
59 59
 
@@ -67,26 +67,26 @@  discard block
 block discarded – undo
67 67
 	 *
68 68
 	 * @return Model|WP_Error
69 69
 	 */
70
-	public function create( array $data = array() ) {
70
+	public function create(array $data = array()) {
71 71
 		/**
72 72
 		 * Model object.
73 73
 		 *
74 74
 		 * @var Model $model
75 75
 		 */
76
-		$model = new $this->class( $data );
76
+		$model = new $this->class($data);
77 77
 
78
-		$id = $this->save_wp_object( $model );
78
+		$id = $this->save_wp_object($model);
79 79
 
80
-		if ( is_wp_error( $id ) ) {
80
+		if (is_wp_error($id)) {
81 81
 			return $id;
82 82
 		}
83 83
 
84 84
 		$model->set_attribute(
85 85
 			'object',
86
-			$this->get_wp_object_by_id( $id )
86
+			$this->get_wp_object_by_id($id)
87 87
 		);
88 88
 
89
-		$this->save_table_attributes( $model );
89
+		$this->save_table_attributes($model);
90 90
 		$model->sync_original();
91 91
 
92 92
 		return $model;
@@ -99,19 +99,19 @@  discard block
 block discarded – undo
99 99
 	 *
100 100
 	 * @return Model|WP_Error
101 101
 	 */
102
-	public function persist( Model $model ) {
103
-		$id = $this->save_wp_object( $model );
102
+	public function persist(Model $model) {
103
+		$id = $this->save_wp_object($model);
104 104
 
105
-		if ( is_wp_error( $id ) ) {
105
+		if (is_wp_error($id)) {
106 106
 			return $id;
107 107
 		}
108 108
 
109 109
 		$model->set_attribute(
110 110
 			'object',
111
-			$this->get_wp_object_by_id( $id )
111
+			$this->get_wp_object_by_id($id)
112 112
 		);
113 113
 
114
-		$this->save_table_attributes( $model );
114
+		$this->save_table_attributes($model);
115 115
 		$model->sync_original();
116 116
 
117 117
 		return $model;
@@ -125,15 +125,15 @@  discard block
 block discarded – undo
125 125
 	 *
126 126
 	 * @return Model|WP_Error
127 127
 	 */
128
-	public function delete( Model $model, $force = false ) {
129
-		$result = $this->delete_wp_object( $model, $force );
128
+	public function delete(Model $model, $force = false) {
129
+		$result = $this->delete_wp_object($model, $force);
130 130
 
131
-		if ( is_wp_error( $result ) ) {
131
+		if (is_wp_error($result)) {
132 132
 			return $result;
133 133
 		}
134 134
 
135
-		if ( $force ) {
136
-			$this->delete_table_attributes( $model );
135
+		if ($force) {
136
+			$this->delete_table_attributes($model);
137 137
 		}
138 138
 
139 139
 		return $model;
@@ -146,8 +146,8 @@  discard block
 block discarded – undo
146 146
 	 *
147 147
 	 * @return Model
148 148
 	 */
149
-	protected function make_model_from_wp_object( $object ) {
150
-		if ( $model = self::get_found( $this->class, $this->get_wp_object_id( $object ) ) ) {
149
+	protected function make_model_from_wp_object($object) {
150
+		if ($model = self::get_found($this->class, $this->get_wp_object_id($object))) {
151 151
 			return $model;
152 152
 		}
153 153
 
@@ -156,12 +156,12 @@  discard block
 block discarded – undo
156 156
 		 *
157 157
 		 * @var Model $model
158 158
 		 */
159
-		$model = new $this->class( array( 'object' => $object ) );
159
+		$model = new $this->class(array('object' => $object));
160 160
 
161
-		if ( $model instanceof UsesCustomTable ) {
162
-			$this->fill_table_attrs_from_table( $model );
161
+		if ($model instanceof UsesCustomTable) {
162
+			$this->fill_table_attrs_from_table($model);
163 163
 		} else {
164
-			$this->fill_table_attrs_from_meta( $model );
164
+			$this->fill_table_attrs_from_meta($model);
165 165
 		}
166 166
 
167 167
 		return $model;
@@ -174,11 +174,11 @@  discard block
 block discarded – undo
174 174
 	 *
175 175
 	 * @param Model $model
176 176
 	 */
177
-	protected function save_table_attributes( Model $model ) {
178
-		if ( $model instanceof UsesCustomTable ) {
179
-			$this->save_table_attributes_to_table( $model );
177
+	protected function save_table_attributes(Model $model) {
178
+		if ($model instanceof UsesCustomTable) {
179
+			$this->save_table_attributes_to_table($model);
180 180
 		} else {
181
-			$this->save_table_attributes_to_meta( $model );
181
+			$this->save_table_attributes_to_meta($model);
182 182
 		}
183 183
 	}
184 184
 
@@ -189,11 +189,11 @@  discard block
 block discarded – undo
189 189
 	 *
190 190
 	 * @param Model $model
191 191
 	 */
192
-	protected function delete_table_attributes( Model $model ) {
193
-		if ( $model instanceof UsesCustomTable ) {
194
-			$this->delete_table_attributes_from_table( $model );
192
+	protected function delete_table_attributes(Model $model) {
193
+		if ($model instanceof UsesCustomTable) {
194
+			$this->delete_table_attributes_from_table($model);
195 195
 		} else {
196
-			$this->delete_table_attributes_from_meta( $model );
196
+			$this->delete_table_attributes_from_meta($model);
197 197
 		}
198 198
 	}
199 199
 
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
 	 *
206 206
 	 * @return string
207 207
 	 */
208
-	protected function make_meta_key( $key ) {
208
+	protected function make_meta_key($key) {
209 209
 		return "_{$this->prefix}_{$key}";
210 210
 	}
211 211
 
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
 	 *
217 217
 	 * @return object|false
218 218
 	 */
219
-	abstract protected function get_wp_object_by_id( $id );
219
+	abstract protected function get_wp_object_by_id($id);
220 220
 
221 221
 	/**
222 222
 	 * Retrieves an array of WordPress objects by the provided params.
@@ -225,14 +225,14 @@  discard block
 block discarded – undo
225 225
 	 *
226 226
 	 * @return array
227 227
 	 */
228
-	abstract protected function get_wp_objects_by_params( $params );
228
+	abstract protected function get_wp_objects_by_params($params);
229 229
 
230 230
 	/**
231 231
 	 * Fills the provided Model with its meta attributes.
232 232
 	 *
233 233
 	 * @param Model $model
234 234
 	 */
235
-	abstract protected function fill_table_attrs_from_meta( Model $model );
235
+	abstract protected function fill_table_attrs_from_meta(Model $model);
236 236
 
237 237
 	/**
238 238
 	 * Save the provided WordPress object to the WordPress database.
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
 	 *
242 242
 	 * @return int|WP_Error
243 243
 	 */
244
-	abstract protected function save_wp_object( Model $model );
244
+	abstract protected function save_wp_object(Model $model);
245 245
 
246 246
 	/**
247 247
 	 * Saves the provided Model's changed table attributes
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
 	 *
250 250
 	 * @param Model $model
251 251
 	 */
252
-	abstract protected function save_table_attributes_to_meta( Model $model );
252
+	abstract protected function save_table_attributes_to_meta(Model $model);
253 253
 
254 254
 	/**
255 255
 	 * Delete the WordPress object associated with the
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
 	 * @param Model $model
260 260
 	 * @param bool  $force
261 261
 	 */
262
-	abstract protected function delete_wp_object( Model $model, $force = false );
262
+	abstract protected function delete_wp_object(Model $model, $force = false);
263 263
 
264 264
 	/**
265 265
 	 * Delete all of the metadata associated with the object on
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
 	 *
268 268
 	 * @param Model $model
269 269
 	 */
270
-	abstract protected function delete_table_attributes_from_meta( Model $model );
270
+	abstract protected function delete_table_attributes_from_meta(Model $model);
271 271
 
272 272
 	/**
273 273
 	 * Gets the primary ID of the provided WordPress object.
@@ -278,14 +278,14 @@  discard block
 block discarded – undo
278 278
 	 *
279 279
 	 * @throws LogicException
280 280
 	 */
281
-	protected function get_wp_object_id( $object ) {
282
-		if ( $object instanceof WP_Post ) {
281
+	protected function get_wp_object_id($object) {
282
+		if ($object instanceof WP_Post) {
283 283
 			return $object->ID;
284 284
 		}
285 285
 
286
-		if ( $object instanceof WP_Term ||
286
+		if ($object instanceof WP_Term ||
287 287
 		     // This is required for WP4.3- compatibility, when they returned stdClass.
288
-		     ( $object instanceof \stdClass && property_exists( $object, 'term_id' ) )
288
+		     ($object instanceof \stdClass && property_exists($object, 'term_id'))
289 289
 		) {
290 290
 			return $object->term_id;
291 291
 		}
Please login to merge, or discard this patch.
src/Http/Filter.php 1 patch
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 	 *
25 25
 	 * @param array $rules
26 26
 	 */
27
-	public function __construct( $rules = array() ) {
27
+	public function __construct($rules = array()) {
28 28
 		$this->rules = $rules;
29 29
 	}
30 30
 
@@ -39,12 +39,12 @@  discard block
 block discarded – undo
39 39
 	public function rules() {
40 40
 		$args = array();
41 41
 
42
-		foreach ( $this->rules as $arg => $validation ) {
43
-			if ( ! $validation || ! is_string( $validation ) ) {
42
+		foreach ($this->rules as $arg => $validation) {
43
+			if (!$validation || !is_string($validation)) {
44 44
 				continue;
45 45
 			}
46 46
 
47
-			$args[ $arg ] = $this->parse_validation( $validation );
47
+			$args[$arg] = $this->parse_validation($validation);
48 48
 		}
49 49
 
50 50
 		return $args;
@@ -59,43 +59,43 @@  discard block
 block discarded – undo
59 59
 	 *
60 60
 	 * @todo The next rule added needs to refactor this process.
61 61
 	 */
62
-	protected function parse_validation( $validation ) {
63
-		$validation = explode( '|', $validation );
62
+	protected function parse_validation($validation) {
63
+		$validation = explode('|', $validation);
64 64
 
65 65
 		$rules = array();
66 66
 
67
-		foreach ( $validation as $rule ) {
68
-			if ( 0 === strpos( $rule, 'default' ) ) {
69
-				$rule_arr = explode( ':', $rule );
67
+		foreach ($validation as $rule) {
68
+			if (0 === strpos($rule, 'default')) {
69
+				$rule_arr = explode(':', $rule);
70 70
 
71
-				$rules['default'] = count( $rule_arr ) === 2 ? array_pop( $rule_arr ) : '';
71
+				$rules['default'] = count($rule_arr) === 2 ? array_pop($rule_arr) : '';
72 72
 			}
73 73
 
74
-			if ( 0 === strpos( $rule, 'oneof' ) ) {
75
-				list( $rule, $values ) = explode( ':', $rule );
74
+			if (0 === strpos($rule, 'oneof')) {
75
+				list($rule, $values) = explode(':', $rule);
76 76
 
77
-				$values   = explode( ',', $values );
78
-				$callback = function ( $value ) use ( $values ) {
79
-					if ( in_array( $value, $values, true ) ) {
77
+				$values   = explode(',', $values);
78
+				$callback = function($value) use ($values) {
79
+					if (in_array($value, $values, true)) {
80 80
 						return true;
81 81
 					}
82 82
 
83 83
 					return false;
84 84
 				};
85 85
 
86
-				$rules['validate_callback'] = isset( $rules['validate_callback'] ) ? $this->add_callback( $rules['validate_callback'], $callback ) : $callback;
86
+				$rules['validate_callback'] = isset($rules['validate_callback']) ? $this->add_callback($rules['validate_callback'], $callback) : $callback;
87 87
 			}
88 88
 
89
-			switch ( $rule ) {
89
+			switch ($rule) {
90 90
 				case 'required':
91 91
 					$rules['required'] = true;
92 92
 					break;
93 93
 				case 'integer':
94
-					$callback                   = array( $this, 'validate_integer' );
95
-					$rules['validate_callback'] = isset( $rules['validate_callback'] ) ? $this->add_callback( $rules['validate_callback'], $callback ) : $callback;
94
+					$callback                   = array($this, 'validate_integer');
95
+					$rules['validate_callback'] = isset($rules['validate_callback']) ? $this->add_callback($rules['validate_callback'], $callback) : $callback;
96 96
 
97
-					$callback                   = array( $this, 'make_integer' );
98
-					$rules['sanitize_callback'] = isset( $rules['sanitize_callback'] ) ? $this->add_callback( $rules['sanitize_callback'], $callback ) : $callback;
97
+					$callback                   = array($this, 'make_integer');
98
+					$rules['sanitize_callback'] = isset($rules['sanitize_callback']) ? $this->add_callback($rules['sanitize_callback'], $callback) : $callback;
99 99
 					break;
100 100
 			}
101 101
 		}
@@ -110,8 +110,8 @@  discard block
 block discarded – undo
110 110
 	 *
111 111
 	 * @return bool
112 112
 	 */
113
-	public function validate_integer( $value ) {
114
-		return filter_var( $value, FILTER_VALIDATE_INT ) !== false;
113
+	public function validate_integer($value) {
114
+		return filter_var($value, FILTER_VALIDATE_INT) !== false;
115 115
 	}
116 116
 
117 117
 	/**
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 	 *
122 122
 	 * @return int
123 123
 	 */
124
-	public function make_integer( $value ) {
124
+	public function make_integer($value) {
125 125
 		return (int) $value;
126 126
 	}
127 127
 
@@ -133,10 +133,10 @@  discard block
 block discarded – undo
133 133
 	 *
134 134
 	 * @return \Closure;
135 135
 	 */
136
-	private function add_callback( $previous, $next ) {
137
-		return function ( $value ) use ( $previous, $next ) {
138
-			if ( call_user_func( $previous, $value ) ) {
139
-				return call_user_func( $next, $value );
136
+	private function add_callback($previous, $next) {
137
+		return function($value) use ($previous, $next) {
138
+			if (call_user_func($previous, $value)) {
139
+				return call_user_func($next, $value);
140 140
 			}
141 141
 
142 142
 			return false;
Please login to merge, or discard this patch.