Completed
Push — master ( ea9096...6a09cf )
by James
04:38
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/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.
src/Http/ServiceProvider.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -23,12 +23,12 @@  discard block
 block discarded – undo
23 23
 	 *
24 24
 	 * @param Container $container
25 25
 	 */
26
-	public function register( Container $container ) {
26
+	public function register(Container $container) {
27 27
 		$this->container = $container;
28 28
 
29
-		$this->container->define( array( 'router' => 'Intraxia\Jaxion\Http\Router' ), $router = new Router );
29
+		$this->container->define(array('router' => 'Intraxia\Jaxion\Http\Router'), $router = new Router);
30 30
 
31
-		$this->add_routes( $router );
31
+		$this->add_routes($router);
32 32
 	}
33 33
 
34 34
 	/**
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 	 *
42 42
 	 * @codeCoverageIgnore
43 43
 	 */
44
-	protected function add_routes( Router $router ) {
44
+	protected function add_routes(Router $router) {
45 45
 		// no-op
46 46
 	}
47 47
 }
Please login to merge, or discard this patch.
src/Contract/Core/HasShortcode.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,5 +15,5 @@
 block discarded – undo
15 15
 	 * @param array  $atts
16 16
 	 * @param string $content
17 17
 	 */
18
-	public function do_shortcode( array $atts, $content = '' );
18
+	public function do_shortcode(array $atts, $content = '');
19 19
 }
Please login to merge, or discard this patch.
src/Contract/Core/Loader.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 	 *
19 19
 	 * @param HasActions $service
20 20
 	 */
21
-	public function register_actions( HasActions $service );
21
+	public function register_actions(HasActions $service);
22 22
 
23 23
 	/**
24 24
 	 * Registers the service's filters with the loader.
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 	 *
29 29
 	 * @param HasFilters $service
30 30
 	 */
31
-	public function register_filters( HasFilters $service );
31
+	public function register_filters(HasFilters $service);
32 32
 
33 33
 	/**
34 34
 	 * Registers the service's shortcode with the loader.
@@ -38,5 +38,5 @@  discard block
 block discarded – undo
38 38
 	 *
39 39
 	 * @param HasShortcode $service
40 40
 	 */
41
-	public function register_shortcode( HasShortcode $service );
41
+	public function register_shortcode(HasShortcode $service);
42 42
 }
Please login to merge, or discard this patch.
src/Contract/Core/ServiceProvider.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -10,5 +10,5 @@
 block discarded – undo
10 10
 	 *
11 11
 	 * @param Container $container
12 12
 	 */
13
-	public function register( Container $container );
13
+	public function register(Container $container);
14 14
 }
Please login to merge, or discard this patch.
src/Assets/ServiceProvider.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -23,15 +23,15 @@  discard block
 block discarded – undo
23 23
 	 *
24 24
 	 * @param Container $container
25 25
 	 */
26
-	public function register( Container $container ) {
26
+	public function register(Container $container) {
27 27
 		$this->container = $container;
28 28
 
29 29
 		$container->define(
30
-			array( 'assets' => 'Intraxia\Jaxion\Contract\Assets\Register' ),
31
-			$register = new Register( $container->fetch( 'url' ), $container->fetch( 'version' ) )
30
+			array('assets' => 'Intraxia\Jaxion\Contract\Assets\Register'),
31
+			$register = new Register($container->fetch('url'), $container->fetch('version'))
32 32
 		);
33 33
 
34
-		$this->add_assets( $register );
34
+		$this->add_assets($register);
35 35
 	}
36 36
 
37 37
 	/**
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 	 *
45 45
 	 * @codeCoverageIgnore
46 46
 	 */
47
-	protected function add_assets( Register $register ) {
47
+	protected function add_assets(Register $register) {
48 48
 		// no-op
49 49
 	}
50 50
 }
Please login to merge, or discard this patch.
src/Core/Container.php 1 patch
Spacing   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -71,17 +71,17 @@  discard block
 block discarded – undo
71 71
 	 *
72 72
 	 * @param ServiceProvider[]|string[] $providers
73 73
 	 */
74
-	public function __construct( array $providers = array() ) {
74
+	public function __construct(array $providers = array()) {
75 75
 		// array_unique ensures we only register each provider once.
76
-		$providers = array_unique( array_merge( $this->providers, $providers ) );
76
+		$providers = array_unique(array_merge($this->providers, $providers));
77 77
 
78
-		foreach ( $providers as $provider ) {
79
-			if ( is_string( $provider ) && class_exists( $provider ) ) {
78
+		foreach ($providers as $provider) {
79
+			if (is_string($provider) && class_exists($provider)) {
80 80
 				$provider = new $provider;
81 81
 			}
82 82
 
83
-			if ( $provider instanceof ServiceProvider ) {
84
-				$this->register( $provider );
83
+			if ($provider instanceof ServiceProvider) {
84
+				$this->register($provider);
85 85
 			}
86 86
 		}
87 87
 	}
@@ -97,27 +97,27 @@  discard block
 block discarded – undo
97 97
 	 *
98 98
 	 * @return $this
99 99
 	 */
100
-	public function define( $alias, $definition ) {
101
-		if ( is_array( $alias ) ) {
102
-			$class = current( $alias );
103
-			$alias = key( $alias );
100
+	public function define($alias, $definition) {
101
+		if (is_array($alias)) {
102
+			$class = current($alias);
103
+			$alias = key($alias);
104 104
 		}
105 105
 
106
-		if ( isset( $this->aliases[ $alias ] ) ) {
107
-			throw new DefinedAliasException( $alias );
106
+		if (isset($this->aliases[$alias])) {
107
+			throw new DefinedAliasException($alias);
108 108
 		}
109 109
 
110
-		$this->aliases[ $alias ]     = true;
111
-		$this->definitions[ $alias ] = $definition;
110
+		$this->aliases[$alias]     = true;
111
+		$this->definitions[$alias] = $definition;
112 112
 
113 113
 		// Closures are treated as factories unless
114 114
 		// defined via Container::share.
115
-		if ( ! $definition instanceof \Closure ) {
116
-			$this->shared[ $alias ] = true;
115
+		if (!$definition instanceof \Closure) {
116
+			$this->shared[$alias] = true;
117 117
 		}
118 118
 
119
-		if ( isset( $class ) ) {
120
-			$this->classes[ $class ] = $alias;
119
+		if (isset($class)) {
120
+			$this->classes[$class] = $alias;
121 121
 		}
122 122
 
123 123
 		return $this;
@@ -133,14 +133,14 @@  discard block
 block discarded – undo
133 133
 	 *
134 134
 	 * @return $this
135 135
 	 */
136
-	public function share( $alias, $definition ) {
137
-		$this->define( $alias, $definition );
136
+	public function share($alias, $definition) {
137
+		$this->define($alias, $definition);
138 138
 
139
-		if ( is_array( $alias ) ) {
140
-			$alias = key( $alias );
139
+		if (is_array($alias)) {
140
+			$alias = key($alias);
141 141
 		}
142 142
 
143
-		$this->shared[ $alias ] = true;
143
+		$this->shared[$alias] = true;
144 144
 
145 145
 		return $this;
146 146
 	}
@@ -154,32 +154,32 @@  discard block
 block discarded – undo
154 154
 	 *
155 155
 	 * @return mixed
156 156
 	 */
157
-	public function fetch( $alias ) {
158
-		if ( isset( $this->classes[ $alias ] ) ) {
157
+	public function fetch($alias) {
158
+		if (isset($this->classes[$alias])) {
159 159
 			// If the alias is a class name,
160 160
 			// then retrieve its linked alias.
161 161
 			// This is only registered when
162 162
 			// registering using an array.
163
-			$alias = $this->classes[ $alias ];
163
+			$alias = $this->classes[$alias];
164 164
 		}
165 165
 
166
-		if ( ! isset( $this->aliases[ $alias ] ) ) {
167
-			throw new UndefinedAliasException( $alias );
166
+		if (!isset($this->aliases[$alias])) {
167
+			throw new UndefinedAliasException($alias);
168 168
 		}
169 169
 
170
-		$value = $this->definitions[ $alias ];
170
+		$value = $this->definitions[$alias];
171 171
 
172 172
 		// If the shared value is a closure,
173 173
 		// execute it and assign the result
174 174
 		// in place of the closure.
175
-		if ( $value instanceof \Closure ) {
175
+		if ($value instanceof \Closure) {
176 176
 			$factory = $value;
177
-			$value   = $factory( $this );
177
+			$value   = $factory($this);
178 178
 		}
179 179
 
180 180
 		// If the value is shared, save the shared value.
181
-		if ( isset( $this->shared[ $alias ] ) ) {
182
-			$this->definitions[ $alias ] = $value;
181
+		if (isset($this->shared[$alias])) {
182
+			$this->definitions[$alias] = $value;
183 183
 		}
184 184
 
185 185
 		// Return the fetched value.
@@ -193,8 +193,8 @@  discard block
 block discarded – undo
193 193
 	 *
194 194
 	 * @return bool
195 195
 	 */
196
-	public function has( $alias ) {
197
-		return isset( $this->aliases[ $alias ] );
196
+	public function has($alias) {
197
+		return isset($this->aliases[$alias]);
198 198
 	}
199 199
 
200 200
 	/**
@@ -204,8 +204,8 @@  discard block
 block discarded – undo
204 204
 	 *
205 205
 	 * @return $this
206 206
 	 */
207
-	public function remove( $alias ) {
208
-		if ( isset( $this->aliases[ $alias ] ) ) {
207
+	public function remove($alias) {
208
+		if (isset($this->aliases[$alias])) {
209 209
 			/**
210 210
 			 * If there's no reference in the aliases array,
211 211
 			 * the service won't be found on fetching and
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
 			 *
221 221
 			 * If this is a problem, this may need to be revisited.
222 222
 			 */
223
-			unset( $this->aliases[ $alias ] );
223
+			unset($this->aliases[$alias]);
224 224
 		}
225 225
 
226 226
 		return $this;
@@ -233,9 +233,9 @@  discard block
 block discarded – undo
233 233
 	 *
234 234
 	 * @return $this
235 235
 	 */
236
-	public function register( ServiceProvider $provider ) {
236
+	public function register(ServiceProvider $provider) {
237 237
 		// @todo make sure provider is only registered once
238
-		$provider->register( $this );
238
+		$provider->register($this);
239 239
 
240 240
 		return $this;
241 241
 	}
@@ -248,8 +248,8 @@  discard block
 block discarded – undo
248 248
 	 *
249 249
 	 * @see    define
250 250
 	 */
251
-	public function offsetSet( $id, $value ) {
252
-		$this->define( $id, $value );
251
+	public function offsetSet($id, $value) {
252
+		$this->define($id, $value);
253 253
 	}
254 254
 
255 255
 	/**
@@ -262,8 +262,8 @@  discard block
 block discarded – undo
262 262
 	 *
263 263
 	 * @see    fetch
264 264
 	 */
265
-	public function offsetGet( $id ) {
266
-		return $this->fetch( $id );
265
+	public function offsetGet($id) {
266
+		return $this->fetch($id);
267 267
 	}
268 268
 
269 269
 	/**
@@ -275,8 +275,8 @@  discard block
 block discarded – undo
275 275
 	 *
276 276
 	 * @see    has
277 277
 	 */
278
-	public function offsetExists( $id ) {
279
-		return $this->has( $id );
278
+	public function offsetExists($id) {
279
+		return $this->has($id);
280 280
 	}
281 281
 
282 282
 	/**
@@ -286,8 +286,8 @@  discard block
 block discarded – undo
286 286
 	 *
287 287
 	 * @see   remove
288 288
 	 */
289
-	public function offsetUnset( $id ) {
290
-		$this->remove( $id );
289
+	public function offsetUnset($id) {
290
+		$this->remove($id);
291 291
 	}
292 292
 
293 293
 	/**
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
 	 */
296 296
 	public function rewind() {
297 297
 		$this->position = 0;
298
-		$this->keys     = array_keys( $this->aliases );
298
+		$this->keys     = array_keys($this->aliases);
299 299
 	}
300 300
 
301 301
 	/**
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
 	 * @return object
305 305
 	 */
306 306
 	public function current() {
307
-		return $this->fetch( $this->keys[ $this->position ] );
307
+		return $this->fetch($this->keys[$this->position]);
308 308
 	}
309 309
 
310 310
 	/**
@@ -313,14 +313,14 @@  discard block
 block discarded – undo
313 313
 	 * @return string
314 314
 	 */
315 315
 	public function key() {
316
-		return $this->keys[ $this->position ];
316
+		return $this->keys[$this->position];
317 317
 	}
318 318
 
319 319
 	/**
320 320
 	 * Increments to the next step in the loop.
321 321
 	 */
322 322
 	public function next() {
323
-		$this->position ++;
323
+		$this->position++;
324 324
 	}
325 325
 
326 326
 	/**
@@ -329,6 +329,6 @@  discard block
 block discarded – undo
329 329
 	 * @return bool
330 330
 	 */
331 331
 	public function valid() {
332
-		return isset( $this->keys[ $this->position ] );
332
+		return isset($this->keys[$this->position]);
333 333
 	}
334 334
 }
Please login to merge, or discard this patch.
src/Utility/Str.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -19,9 +19,9 @@  discard block
 block discarded – undo
19 19
 	 *
20 20
 	 * @return bool
21 21
 	 */
22
-	public static function starts_with( $haystack, $needles ) {
23
-		foreach ( (array) $needles as $needle ) {
24
-			if ( '' !== $needle && 0 === strpos( $haystack, $needle ) ) {
22
+	public static function starts_with($haystack, $needles) {
23
+		foreach ((array) $needles as $needle) {
24
+			if ('' !== $needle && 0 === strpos($haystack, $needle)) {
25 25
 				return true;
26 26
 			}
27 27
 		}
@@ -37,9 +37,9 @@  discard block
 block discarded – undo
37 37
 	 *
38 38
 	 * @return bool
39 39
 	 */
40
-	public static function ends_with( $haystack, $needles ) {
41
-		foreach ( (array) $needles as $needle ) {
42
-			if ( substr( $haystack, - strlen( $needle ) ) === (string) $needle ) {
40
+	public static function ends_with($haystack, $needles) {
41
+		foreach ((array) $needles as $needle) {
42
+			if (substr($haystack, - strlen($needle)) === (string) $needle) {
43 43
 				return true;
44 44
 			}
45 45
 		}
Please login to merge, or discard this patch.