Completed
Pull Request — master (#6)
by James
03:23
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/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/Guard.php 1 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/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/Contract/Axolotl/EntityManager.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 	 *
15 15
 	 * @return Model|WP_Error
16 16
 	 */
17
-	public function find( $class, $id );
17
+	public function find($class, $id);
18 18
 
19 19
 	/**
20 20
 	 * Finds all the models of the provided class for the given params.
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 	 *
27 27
 	 * @return Collection|WP_Error
28 28
 	 */
29
-	public function find_by( $class, $params = array() );
29
+	public function find_by($class, $params = array());
30 30
 
31 31
 	/**
32 32
 	 * Saves a new model of the provided class with the given data.
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 	 *
37 37
 	 * @return Model|WP_Error
38 38
 	 */
39
-	public function create( $class, $data = array() );
39
+	public function create($class, $data = array());
40 40
 
41 41
 	/**
42 42
 	 * Updates a model with its latest data.
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 	 *
46 46
 	 * @return Model|WP_Error
47 47
 	 */
48
-	public function persist( Model $model );
48
+	public function persist(Model $model);
49 49
 
50 50
 	/**
51 51
 	 * Delete the provided Model.
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 	 *
56 56
 	 * @return Model|WP_Error
57 57
 	 */
58
-	public function delete( Model $model, $force = false );
58
+	public function delete(Model $model, $force = false);
59 59
 
60 60
 	/**
61 61
 	 * Frees all currently managed models from the EntityManager.
Please login to merge, or discard this patch.