Completed
Pull Request — master (#3)
by James
02:59
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/Http/Guard.php 2 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -1,7 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 namespace Intraxia\Jaxion\Model;
3 3
 
4
-use Intraxia\Jaxion\Utility\Str;
5 4
 use stdClass;
6 5
 use WP_Post;
7 6
 
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -37,8 +37,8 @@  discard block
 block discarded – undo
37 37
 	 *
38 38
 	 * @param array $options
39 39
 	 */
40
-	public function __construct( array $options = array() ) {
41
-		$this->options = $this->set_defaults( $options );
40
+	public function __construct(array $options = array()) {
41
+		$this->options = $this->set_defaults($options);
42 42
 	}
43 43
 
44 44
 	/**
@@ -48,24 +48,24 @@  discard block
 block discarded – undo
48 48
 	 */
49 49
 	public function authorized() {
50 50
 		// if the rule is public, always authorized
51
-		if ( 'public' === $this->options['rule'] ) {
51
+		if ('public' === $this->options['rule']) {
52 52
 			return true;
53 53
 		}
54 54
 
55 55
 		// enable passing in callback
56
-		if ( 'callback' === $this->options['rule'] && is_callable( $this->options['callback'] ) ) {
57
-			return call_user_func( $this->options['callback'] );
56
+		if ('callback' === $this->options['rule'] && is_callable($this->options['callback'])) {
57
+			return call_user_func($this->options['callback']);
58 58
 		}
59 59
 
60 60
 		// map rule to method
61
-		if ( method_exists( $this, $method = $this->options['rule'] ) ) {
61
+		if (method_exists($this, $method = $this->options['rule'])) {
62 62
 			return $this->{$method}();
63 63
 		}
64 64
 
65 65
 		// disable in rule is misconfigused
66 66
 		// @todo set up internal translations
67 67
 		// @todo also, this error message kinda sucks
68
-		return new WP_Error( '500', __( 'Guard failure', 'jaxion' ) );
68
+		return new WP_Error('500', __('Guard failure', 'jaxion'));
69 69
 	}
70 70
 
71 71
 	/**
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 	 * @return bool|WP_Error
75 75
 	 */
76 76
 	protected function can_edit_others_posts() {
77
-		return current_user_can( 'edit_others_posts' ) ?: new WP_Error( 'unauthorized', __( 'Unauthorized user', 'jaxion' ), array( 'status' => 401 ) );
77
+		return current_user_can('edit_others_posts') ?: new WP_Error('unauthorized', __('Unauthorized user', 'jaxion'), array('status' => 401));
78 78
 	}
79 79
 
80 80
 	/**
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 	 * @return bool|WP_Error
84 84
 	 */
85 85
 	protected function user_logged_in() {
86
-		return is_user_logged_in() ?: new WP_Error( 'unauthorized', __( 'Unauthorized user', 'jaxion' ), array( 'status' => 401 ) );
86
+		return is_user_logged_in() ?: new WP_Error('unauthorized', __('Unauthorized user', 'jaxion'), array('status' => 401));
87 87
 	}
88 88
 
89 89
 	/**
@@ -93,8 +93,8 @@  discard block
 block discarded – undo
93 93
 	 *
94 94
 	 * @return array
95 95
 	 */
96
-	protected function set_defaults( $options ) {
96
+	protected function set_defaults($options) {
97 97
 		// these are the valid options
98
-		return wp_parse_args( $options, $this->defaults );
98
+		return wp_parse_args($options, $this->defaults);
99 99
 	}
100 100
 }
Please login to merge, or discard this patch.
src/Axolotl/EntityManager.php 2 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -3,7 +3,6 @@
 block discarded – undo
3 3
 
4 4
 use Intraxia\Jaxion\Axolotl\Relationship\Root as Relationship;
5 5
 use Intraxia\Jaxion\Axolotl\Repository\AbstractRepository;
6
-use Intraxia\Jaxion\Axolotl\Repository\CustomTable as CustomTableRepository;
7 6
 use Intraxia\Jaxion\Axolotl\Repository\WordPressPost as WordPressPostRepository;
8 7
 use Intraxia\Jaxion\Axolotl\Repository\WordPressTerm as WordPressTermRepository;
9 8
 use Intraxia\Jaxion\Contract\Axolotl\EntityManager as EntityManagerContract;
Please login to merge, or discard this patch.
Spacing   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 	 * @param WP_Query $main
50 50
 	 * @param string   $prefix Post meta prefix.
51 51
 	 */
52
-	public function __construct( WP_Query $main, $prefix ) {
52
+	public function __construct(WP_Query $main, $prefix) {
53 53
 		global $wpdb;
54 54
 
55 55
 		$this->wpdb   = $wpdb;
@@ -67,15 +67,15 @@  discard block
 block discarded – undo
67 67
 	 *
68 68
 	 * @throws LogicException
69 69
 	 */
70
-	public function find( $class, $id ) {
71
-		$repository = $this->get_repository( $class );
72
-		$model      = $repository->find( $id );
70
+	public function find($class, $id) {
71
+		$repository = $this->get_repository($class);
72
+		$model      = $repository->find($id);
73 73
 
74
-		if ( is_wp_error( $model ) ) {
74
+		if (is_wp_error($model)) {
75 75
 			return $model;
76 76
 		}
77 77
 
78
-		$this->handle_model( $repository, $model );
78
+		$this->handle_model($repository, $model);
79 79
 
80 80
 		return $model;
81 81
 	}
@@ -90,12 +90,12 @@  discard block
 block discarded – undo
90 90
 	 *
91 91
 	 * @throws LogicException
92 92
 	 */
93
-	public function find_by( $class, $params = array() ) {
94
-		$repository = $this->get_repository( $class );
95
-		$collection = $repository->find_by( $params );
93
+	public function find_by($class, $params = array()) {
94
+		$repository = $this->get_repository($class);
95
+		$collection = $repository->find_by($params);
96 96
 
97
-		foreach ( $collection as $model ) {
98
-			$this->handle_model( $repository, $model );
97
+		foreach ($collection as $model) {
98
+			$this->handle_model($repository, $model);
99 99
 		}
100 100
 
101 101
 		return $collection;
@@ -109,11 +109,11 @@  discard block
 block discarded – undo
109 109
 	 *
110 110
 	 * @return Model|WP_Error
111 111
 	 */
112
-	public function create( $class, $data = array() ) {
113
-		$repository = $this->get_repository( $class );
114
-		$model      = $repository->create( $data );
112
+	public function create($class, $data = array()) {
113
+		$repository = $this->get_repository($class);
114
+		$model      = $repository->create($data);
115 115
 
116
-		$this->handle_model( $repository, $model );
116
+		$this->handle_model($repository, $model);
117 117
 
118 118
 		return $model;
119 119
 	}
@@ -125,8 +125,8 @@  discard block
 block discarded – undo
125 125
 	 *
126 126
 	 * @return Model|WP_Error
127 127
 	 */
128
-	public function persist( Model $model ) {
129
-		return $this->get_repository( get_class( $model ) )->persist( $model );
128
+	public function persist(Model $model) {
129
+		return $this->get_repository(get_class($model))->persist($model);
130 130
 	}
131 131
 
132 132
 	/**
@@ -137,8 +137,8 @@  discard block
 block discarded – undo
137 137
 	 *
138 138
 	 * @return Model|WP_Error
139 139
 	 */
140
-	public function delete( Model $model, $force = false ) {
141
-		return $this->get_repository( get_class( $model ) )->delete( $model, $force );
140
+	public function delete(Model $model, $force = false) {
141
+		return $this->get_repository(get_class($model))->delete($model, $force);
142 142
 	}
143 143
 
144 144
 	/**
@@ -184,30 +184,30 @@  discard block
 block discarded – undo
184 184
 	 *
185 185
 	 * @throws LogicException
186 186
 	 */
187
-	protected function get_repository( $class ) {
187
+	protected function get_repository($class) {
188 188
 		// We can only use Axolotl models.
189
-		if ( ! is_subclass_of( $class, 'Intraxia\Jaxion\Axolotl\Model' ) ) {
189
+		if (!is_subclass_of($class, 'Intraxia\Jaxion\Axolotl\Model')) {
190 190
 			throw new LogicException;
191 191
 		}
192 192
 
193
-		if ( is_subclass_of(
193
+		if (is_subclass_of(
194 194
 			$class,
195 195
 			'Intraxia\Jaxion\Contract\Axolotl\UsesWordPressPost'
196
-		) ) {
197
-			return new WordPressPostRepository( $this, $class );
196
+		)) {
197
+			return new WordPressPostRepository($this, $class);
198 198
 		}
199 199
 
200
-		if ( is_subclass_of(
200
+		if (is_subclass_of(
201 201
 			$class,
202 202
 			'Intraxia\Jaxion\Contract\Axolotl\UsesWordPressTerm'
203
-		) ) {
204
-			return new WordPressTermRepository( $this, $class );
203
+		)) {
204
+			return new WordPressTermRepository($this, $class);
205 205
 		}
206 206
 
207
-		if ( is_subclass_of(
207
+		if (is_subclass_of(
208 208
 			$class,
209 209
 			'Intraxia\Jaxion\Contract\Axolotl\UsesCustomTable'
210
-		) ) {
210
+		)) {
211 211
 			throw new LogicException;
212 212
 		}
213 213
 
@@ -222,11 +222,11 @@  discard block
 block discarded – undo
222 222
 	 * @param AbstractRepository $repository
223 223
 	 * @param Model              $model
224 224
 	 */
225
-	protected function handle_model( AbstractRepository $repository, Model $model ) {
226
-		$repository->register_model( $model );
225
+	protected function handle_model(AbstractRepository $repository, Model $model) {
226
+		$repository->register_model($model);
227 227
 
228
-		if ( $model instanceof HasEagerRelationships ) {
229
-			$this->fill_related( $model, $model::get_eager_relationships() );
228
+		if ($model instanceof HasEagerRelationships) {
229
+			$this->fill_related($model, $model::get_eager_relationships());
230 230
 		}
231 231
 	}
232 232
 
@@ -240,17 +240,17 @@  discard block
 block discarded – undo
240 240
 	 *
241 241
 	 * @throws LogicException
242 242
 	 */
243
-	protected function fill_related( Model $model, array $relations = array() ) {
244
-		if ( ! $relations ) {
243
+	protected function fill_related(Model $model, array $relations = array()) {
244
+		if (!$relations) {
245 245
 			$relations = $model->get_related_keys();
246 246
 		}
247 247
 
248
-		foreach ( $relations as $relation ) {
249
-			if ( ! in_array( $relation, $model->get_related_keys() ) ) {
248
+		foreach ($relations as $relation) {
249
+			if (!in_array($relation, $model->get_related_keys())) {
250 250
 				throw new LogicException;
251 251
 			}
252 252
 
253
-			if ( $model->relation_is_filled( $relation ) ) {
253
+			if ($model->relation_is_filled($relation)) {
254 254
 				continue;
255 255
 			}
256 256
 
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
 			 * @var Relationship $relation
261 261
 			 */
262 262
 			$relation = $model->{"related_{$relation}"}();
263
-			$relation->attach_relation( $this );
263
+			$relation->attach_relation($this);
264 264
 		}
265 265
 	}
266 266
 }
Please login to merge, or discard this patch.
src/Axolotl/Relationship/BelongsToOne.php 2 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -3,7 +3,6 @@
 block discarded – undo
3 3
 
4 4
 use Intraxia\Jaxion\Axolotl\EntityManager;
5 5
 use Intraxia\Jaxion\Axolotl\Model;
6
-use Intraxia\Jaxion\Contract\Axolotl\UsesWordPressPost;
7 6
 use LogicException;
8 7
 
9 8
 /**
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/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.