Completed
Pull Request — master (#124)
by Maciej
02:05
created
src/Abstraction/Collectable.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 	 * @access private
109 109
 	 *
110 110
 	 * @param array $array
111
-	 * @param string|array $callback
111
+	 * @param callable $callback
112 112
 	 * @return array
113 113
 	 */
114 114
 	protected function transform_array_leafs( array $array, $callback ) {
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 	 * @since 0.10.0
125 125
 	 * @access private
126 126
 	 *
127
-	 * @param string|array $callback
127
+	 * @param callable $callback
128 128
 	 * @param string (optional) $input The input string
129 129
 	 * @return
130 130
 	 */
Please login to merge, or discard this patch.
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 namespace WFV\Abstraction;
3
-defined( 'ABSPATH' ) || die();
3
+defined('ABSPATH') || die();
4 4
 
5 5
 use WFV\Contract\CollectionInterface;
6 6
 
@@ -29,13 +29,13 @@  discard block
 block discarded – undo
29 29
 	 * @param string $value
30 30
 	 * @return bool
31 31
 	 */
32
-	public function contains( $key = null, $value = null ) {
32
+	public function contains($key = null, $value = null) {
33 33
 		// WIP
34
-		if( $this->has( $key ) ) {
35
-			if ( is_array( $this->data[ $key ] ) ) {
36
-				return ( in_array( $value, $this->data[ $key ] ) ) ? true : false;
34
+		if ($this->has($key)) {
35
+			if (is_array($this->data[$key])) {
36
+				return (in_array($value, $this->data[$key])) ? true : false;
37 37
 			}
38
-			return ( $this->data[ $key ] === $value ) ? true : false;
38
+			return ($this->data[$key] === $value) ? true : false;
39 39
 		}
40 40
 		return false;
41 41
 	}
@@ -49,10 +49,10 @@  discard block
 block discarded – undo
49 49
 	 * @param string|array (optional) $callback Context appropriate callable.
50 50
 	 * @return string|null
51 51
 	 */
52
-	public function escape( $key, callable $callback = null ) {
53
-		if( is_string( $key ) ) {
54
-			$callback = ( null === $callback ) ? 'esc_html' : $callback;
55
-			return ( true === $this->has( $key ) ) ? $this->call_func( $callback, $this->data[ $key ] ) : null;
52
+	public function escape($key, callable $callback = null) {
53
+		if (is_string($key)) {
54
+			$callback = (null === $callback) ? 'esc_html' : $callback;
55
+			return (true === $this->has($key)) ? $this->call_func($callback, $this->data[$key]) : null;
56 56
 		}
57 57
 		return null;
58 58
 	}
@@ -65,8 +65,8 @@  discard block
 block discarded – undo
65 65
 	 * @param string $key
66 66
 	 * @return bool
67 67
 	 */
68
-	public function has( $key = null ) {
69
-		return array_key_exists( $key, $this->data );
68
+	public function has($key = null) {
69
+		return array_key_exists($key, $this->data);
70 70
 	}
71 71
 
72 72
 	/**
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 	 * @return bool
78 78
 	 */
79 79
 	public function is_populated() {
80
-		return ( count( $this->data ) > 0 ) ? true : false;
80
+		return (count($this->data) > 0) ? true : false;
81 81
 	}
82 82
 
83 83
 	/**
@@ -90,11 +90,11 @@  discard block
 block discarded – undo
90 90
 	 * @param callable $callback
91 91
 	 * @return array
92 92
 	 */
93
-	public function transform( $key = null, callable $callback ) {
93
+	public function transform($key = null, callable $callback) {
94 94
 		// WIP
95
-		if( true === $this->has( $key ) ) {
96
-			if( is_array( $this->data[ $key ] ) ) {
97
-				return $this->transform_array_leafs( $this->data[ $key ], $callback );
95
+		if (true === $this->has($key)) {
96
+			if (is_array($this->data[$key])) {
97
+				return $this->transform_array_leafs($this->data[$key], $callback);
98 98
 			}
99 99
 		}
100 100
 	}
@@ -111,9 +111,9 @@  discard block
 block discarded – undo
111 111
 	 * @param string|array $callback
112 112
 	 * @return array
113 113
 	 */
114
-	protected function transform_array_leafs( array $array, $callback ) {
115
-		array_walk_recursive( $array, function( &$item ) use( $callback ) {
116
-			$item = $this->call_func( $callback, $item );
114
+	protected function transform_array_leafs(array $array, $callback) {
115
+		array_walk_recursive($array, function(&$item) use($callback) {
116
+			$item = $this->call_func($callback, $item);
117 117
 		} );
118 118
 		return $array;
119 119
 	}
@@ -128,16 +128,16 @@  discard block
 block discarded – undo
128 128
 	 * @param string (optional) $input The input string
129 129
 	 * @return
130 130
 	 */
131
-	private function call_func( $callback, $input = null ) {
131
+	private function call_func($callback, $input = null) {
132 132
 		// WIP - simplify
133
-		if( is_array( $callback ) ) {
133
+		if (is_array($callback)) {
134 134
 			$method = $callback[0];
135 135
 			$args = $callback[1];
136
-			if ( $input ) {
137
-				array_unshift( $args, $input );
136
+			if ($input) {
137
+				array_unshift($args, $input);
138 138
 			}
139
-			return call_user_func_array( $method, $args );
139
+			return call_user_func_array($method, $args);
140 140
 		}
141
-		return $callback( $input );
141
+		return $callback($input);
142 142
 	}
143 143
 }
Please login to merge, or discard this patch.
src/FormComposite.php 1 patch
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 namespace WFV;
3
-defined( 'ABSPATH' ) || die();
3
+defined('ABSPATH') || die();
4 4
 
5 5
 use WFV\Abstraction\Composable;
6 6
 use WFV\Contract\ArtisanInterface;
@@ -30,9 +30,9 @@  discard block
 block discarded – undo
30 30
 	 * @param ArtisanInterface $builder
31 31
 	 * @param string $action
32 32
 	 */
33
-	public function __construct( ArtisanInterface $builder, $action ) {
33
+	public function __construct(ArtisanInterface $builder, $action) {
34 34
 		$this->alias = $action;
35
-		$this->install( $builder->collection );
35
+		$this->install($builder->collection);
36 36
 		$this->validator = $builder->validator;
37 37
 	}
38 38
 
@@ -45,8 +45,8 @@  discard block
 block discarded – undo
45 45
 	 * @param string $value Value to compare against.
46 46
 	 * @return string|null
47 47
 	 */
48
-	public function checked_if( $field = null, $value = null ) {
49
-		return $this->string_or_null( 'checked', $field, $value );
48
+	public function checked_if($field = null, $value = null) {
49
+		return $this->string_or_null('checked', $field, $value);
50 50
 	}
51 51
 
52 52
 	/**
@@ -60,8 +60,8 @@  discard block
 block discarded – undo
60 60
 	 * @param callable (optional) $callback
61 61
 	 * @return string
62 62
 	 */
63
-	public function display( $field = null, callable $callback = null ) {
64
-		echo $input = $this->utilize('input')->escape( $field );
63
+	public function display($field = null, callable $callback = null) {
64
+		echo $input = $this->utilize('input')->escape($field);
65 65
 		return $input;
66 66
 	}
67 67
 
@@ -99,10 +99,10 @@  discard block
 block discarded – undo
99 99
 	 */
100 100
 	public function is_valid() {
101 101
 		$is_valid = $this->validator->is_valid();
102
-		if( false === $is_valid ) {
103
-			$this->utilize('errors')->set_errors( $this->validator->errors() );
102
+		if (false === $is_valid) {
103
+			$this->utilize('errors')->set_errors($this->validator->errors());
104 104
 		}
105
-		$this->trigger_post_validate_action( $is_valid );
105
+		$this->trigger_post_validate_action($is_valid);
106 106
 		return $is_valid;
107 107
 	}
108 108
 
@@ -137,8 +137,8 @@  discard block
 block discarded – undo
137 137
 	 * @param string $value Value to compare against.
138 138
 	 * @return string|null
139 139
 	 */
140
-	public function selected_if( $field = null, $value = null ) {
141
-		return $this->string_or_null( 'selected', $field, $value );
140
+	public function selected_if($field = null, $value = null) {
141
+		return $this->string_or_null('selected', $field, $value);
142 142
 	}
143 143
 
144 144
 	/**
@@ -150,9 +150,9 @@  discard block
 block discarded – undo
150 150
 	 */
151 151
 	public function token_fields() {
152 152
 		// TODO - Move markup into something - perhaps a renderable interface?
153
-		$token_name = $this->alias . '_token';
154
-		echo $nonce_field = wp_nonce_field( $this->alias, $token_name, false, false );
155
-		echo $action_field = '<input type="hidden" name="action" value="'. $this->alias .'">';
153
+		$token_name = $this->alias.'_token';
154
+		echo $nonce_field = wp_nonce_field($this->alias, $token_name, false, false);
155
+		echo $action_field = '<input type="hidden" name="action" value="'.$this->alias.'">';
156 156
 	}
157 157
 
158 158
 	/**
@@ -163,9 +163,9 @@  discard block
 block discarded – undo
163 163
 	 * @param ValidateInterface $rule
164 164
 	 * @param string $field
165 165
 	 */
166
-	public function validate( ValidateInterface $rule, $field ) {
167
-		$input = $this->field_value( $field );
168
-		$this->validator->validate( $rule, $field, $input );
166
+	public function validate(ValidateInterface $rule, $field) {
167
+		$input = $this->field_value($field);
168
+		$this->validator->validate($rule, $field, $input);
169 169
 	}
170 170
 
171 171
 	/**
@@ -176,11 +176,11 @@  discard block
 block discarded – undo
176 176
 	 *
177 177
 	 * @param string $field
178 178
 	 */
179
-	protected function field_value( $field ) {
179
+	protected function field_value($field) {
180 180
 		$input = $this->utilize('input');
181
-		if( $input->has( $field ) ) {
182
-			$input = $input->get_array( false );
183
-			return $input[ $field ];
181
+		if ($input->has($field)) {
182
+			$input = $input->get_array(false);
183
+			return $input[$field];
184 184
 		}
185 185
 		return null;
186 186
 	}
@@ -196,8 +196,8 @@  discard block
 block discarded – undo
196 196
 	 * @param string (optional) $value
197 197
 	 * @return string|null
198 198
 	 */
199
-	protected function string_or_null( $response, $field = null, $value = null ) {
200
-		return ( $this->input( $field )->contains( $field, $value ) ) ? $response : null;
199
+	protected function string_or_null($response, $field = null, $value = null) {
200
+		return ($this->input($field)->contains($field, $value)) ? $response : null;
201 201
 	}
202 202
 
203 203
 	/**
@@ -208,8 +208,8 @@  discard block
 block discarded – undo
208 208
 	 *
209 209
 	 * @param bool $is_valid
210 210
 	 */
211
-	protected function trigger_post_validate_action( $is_valid = false ) {
212
-		$action = ( true === $is_valid ) ? $this->alias : $this->alias .'_fail';
213
-		do_action( $action, $this );
211
+	protected function trigger_post_validate_action($is_valid = false) {
212
+		$action = (true === $is_valid) ? $this->alias : $this->alias.'_fail';
213
+		do_action($action, $this);
214 214
 	}
215 215
 }
Please login to merge, or discard this patch.
src/Collection/ErrorCollection.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 namespace WFV\Collection;
3
-defined( 'ABSPATH' ) || die();
3
+defined('ABSPATH') || die();
4 4
 
5 5
 use WFV\Abstraction\Collectable;
6 6
 
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 	 *
27 27
 	 * @param array $labels Human friendly labels for the fields
28 28
 	 */
29
-	function __construct( array $labels = [] ) {
29
+	function __construct(array $labels = []) {
30 30
 		$this->labels = $labels;
31 31
 	}
32 32
 
@@ -38,9 +38,9 @@  discard block
 block discarded – undo
38 38
 	 * @param string $field
39 39
 	 * @return string|null
40 40
 	 */
41
-	public function first( $field ) {
42
-		return ( $this->data[ $field ] )
43
-			? array_values( $this->data[ $field ] )[0]
41
+	public function first($field) {
42
+		return ($this->data[$field])
43
+			? array_values($this->data[$field])[0]
44 44
 			: null;
45 45
 	}
46 46
 
@@ -52,10 +52,10 @@  discard block
 block discarded – undo
52 52
 	 *
53 53
 	 * @param array $errors
54 54
 	 */
55
-	public function set_errors( array $errors = [] ) {
56
-		$this->data = ( $this->is_populated() )
55
+	public function set_errors(array $errors = []) {
56
+		$this->data = ($this->is_populated())
57 57
 			? $this->data
58
-			: $this->with_labels( $errors );
58
+			: $this->with_labels($errors);
59 59
 	}
60 60
 
61 61
 	/**
@@ -68,9 +68,9 @@  discard block
 block discarded – undo
68 68
 	 * @param string $field
69 69
 	 * @return string
70 70
 	 */
71
-	protected function label( $field ) {
72
-		return ( isset( $this->labels[ $field ] ) )
73
-			? $this->labels[ $field ]
71
+	protected function label($field) {
72
+		return (isset($this->labels[$field]))
73
+			? $this->labels[$field]
74 74
 			: $field;
75 75
 	}
76 76
 
@@ -83,11 +83,11 @@  discard block
 block discarded – undo
83 83
 	 * @param array $errors
84 84
 	 * @return array
85 85
 	 */
86
-	protected function with_labels( $errors ) {
86
+	protected function with_labels($errors) {
87 87
 		$labeled = array();
88
-		foreach( $errors as $field => $messages ) {
89
-			$label = $this->label( $field );
90
-			$labeled[ $field ] = str_replace( '{label}', $label, $errors[ $field ] );
88
+		foreach ($errors as $field => $messages) {
89
+			$label = $this->label($field);
90
+			$labeled[$field] = str_replace('{label}', $label, $errors[$field]);
91 91
 		}
92 92
 		return $labeled;
93 93
 	}
Please login to merge, or discard this patch.
src/Collection/MessageCollection.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 namespace WFV\Collection;
3
-defined( 'ABSPATH' ) || die();
3
+defined('ABSPATH') || die();
4 4
 use WFV\Abstraction\Collectable;
5 5
 /**
6 6
  *
@@ -16,8 +16,8 @@  discard block
 block discarded – undo
16 16
 	 *
17 17
 	 * @param array $form Config array
18 18
 	 */
19
-	public function __construct( array $form ) {
20
-		$this->set_messages( $form );
19
+	public function __construct(array $form) {
20
+		$this->set_messages($form);
21 21
 	}
22 22
 
23 23
 	/**
@@ -41,9 +41,9 @@  discard block
 block discarded – undo
41 41
 	 * @param array $form
42 42
 	 * @return array
43 43
 	 */
44
-	protected function filter_config( array $form ) {
45
-		return array_filter( $form, function( $item ) {
46
-			return array_key_exists('messages', $item );
44
+	protected function filter_config(array $form) {
45
+		return array_filter($form, function($item) {
46
+			return array_key_exists('messages', $item);
47 47
 		});
48 48
 	}
49 49
 
@@ -55,10 +55,10 @@  discard block
 block discarded – undo
55 55
 	 *
56 56
 	 * @param array
57 57
 	 */
58
-	protected function make_array( array $filtered ) {
58
+	protected function make_array(array $filtered) {
59 59
 		$messages = array();
60
-		foreach( $filtered as $field => $options ) {
61
-			$messages[ $field ] = $options['messages'];
60
+		foreach ($filtered as $field => $options) {
61
+			$messages[$field] = $options['messages'];
62 62
 		}
63 63
 		return $messages;
64 64
 	}
@@ -71,8 +71,8 @@  discard block
 block discarded – undo
71 71
 	 *
72 72
 	 * @param array $form
73 73
 	 */
74
-	protected function set_messages( array $form ) {
75
-		$filtered = $this->filter_config( $form );
76
-		$this->data = $this->make_array( $filtered );
74
+	protected function set_messages(array $form) {
75
+		$filtered = $this->filter_config($form);
76
+		$this->data = $this->make_array($filtered);
77 77
 	}
78 78
 }
Please login to merge, or discard this patch.
src/Collection/InputCollection.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 namespace WFV\Collection;
3
-defined( 'ABSPATH' ) || die();
3
+defined('ABSPATH') || die();
4 4
 
5 5
 use WFV\Abstraction\Collectable;
6 6
 
@@ -20,9 +20,9 @@  discard block
 block discarded – undo
20 20
 	 * @param array $data
21 21
 	 * @param bool $trim
22 22
 	 */
23
-	public function __construct( array $data = array(), $trim ) {
24
-		$data = $this->transform_array_leafs( $data, 'stripslashes' );
25
-		$this->data = ( $trim ) ? $this->transform_array_leafs( $data, 'trim' ) : $data;
23
+	public function __construct(array $data = array(), $trim) {
24
+		$data = $this->transform_array_leafs($data, 'stripslashes');
25
+		$this->data = ($trim) ? $this->transform_array_leafs($data, 'trim') : $data;
26 26
 	}
27 27
 
28 28
 	/**
@@ -33,8 +33,8 @@  discard block
 block discarded – undo
33 33
 	 * @param bool $tokens With or without token and action attributes.
34 34
 	 * @return array
35 35
 	 */
36
-	public function get_array( $tokens = true ) {
37
-		return ( $tokens ) ? $this->data : $this->neat_array();
36
+	public function get_array($tokens = true) {
37
+		return ($tokens) ? $this->data : $this->neat_array();
38 38
 	}
39 39
 
40 40
 	/**
@@ -47,8 +47,8 @@  discard block
 block discarded – undo
47 47
 	 */
48 48
 	protected function neat_array() {
49 49
 		$input = $this->data;
50
-		unset( $input[ $input['action'] .'_token'] );
51
-		unset( $input['action'] );
50
+		unset($input[$input['action'].'_token']);
51
+		unset($input['action']);
52 52
 		return $input;
53 53
 	}
54 54
 }
Please login to merge, or discard this patch.
src/Collection/RuleCollection.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 namespace WFV\Collection;
3
-defined( 'ABSPATH' ) || die();
3
+defined('ABSPATH') || die();
4 4
 
5 5
 use WFV\Abstraction\Collectable;
6 6
 
@@ -18,8 +18,8 @@  discard block
 block discarded – undo
18 18
 	 *
19 19
 	 * @param array $rules
20 20
 	 */
21
-	public function __construct( array $rules ) {
22
-		$this->data = $this->parse_rules( $rules );
21
+	public function __construct(array $rules) {
22
+		$this->data = $this->parse_rules($rules);
23 23
 	}
24 24
 
25 25
 
@@ -43,8 +43,8 @@  discard block
 block discarded – undo
43 43
 	 * @param string $rule
44 44
 	 * @return string
45 45
 	 */
46
-	protected function extract_name( $rule ) {
47
-		return strstr( $rule, ':', true );
46
+	protected function extract_name($rule) {
47
+		return strstr($rule, ':', true);
48 48
 	}
49 49
 
50 50
 	/**
@@ -56,8 +56,8 @@  discard block
 block discarded – undo
56 56
 	 * @param string $rule
57 57
 	 * @return string
58 58
 	 */
59
-	protected function extract_params( $rule ) {
60
-		return ltrim( strstr($rule, ':'), ':');
59
+	protected function extract_params($rule) {
60
+		return ltrim(strstr($rule, ':'), ':');
61 61
 	}
62 62
 
63 63
 	/**
@@ -69,8 +69,8 @@  discard block
 block discarded – undo
69 69
 	 * @param string $rule
70 70
 	 * @return bool
71 71
 	 */
72
-	protected function has_parameters( $rule ) {
73
-		return strpos( $rule, ':' );
72
+	protected function has_parameters($rule) {
73
+		return strpos($rule, ':');
74 74
 	}
75 75
 
76 76
 	/**
@@ -83,20 +83,20 @@  discard block
 block discarded – undo
83 83
 	 * @param array $rules
84 84
 	 * @return array
85 85
 	 */
86
-	protected function parse_rules( array $rules ) {
86
+	protected function parse_rules(array $rules) {
87 87
 		// WIP - works, but confusing - simplify or breakdown into small methods
88 88
 		$parsed = array();
89
-		$this->split_rules( $rules );
90
-		foreach( $rules as $field => $ruleset ) {
91
-			$parsed[ $field ] = array_map( function( $rule ) {
92
-				if ( $this->has_parameters( $rule ) ) {
89
+		$this->split_rules($rules);
90
+		foreach ($rules as $field => $ruleset) {
91
+			$parsed[$field] = array_map(function($rule) {
92
+				if ($this->has_parameters($rule)) {
93 93
 					return array(
94
-						'rule' => $this->extract_name( $rule ),
95
-						'params' => explode( ',', $this->extract_params( $rule ) )
94
+						'rule' => $this->extract_name($rule),
95
+						'params' => explode(',', $this->extract_params($rule))
96 96
 					);
97 97
 				}
98 98
 				return $rule;
99
-			}, $ruleset );
99
+			}, $ruleset);
100 100
 		}
101 101
 		return $parsed;
102 102
 	}
@@ -109,10 +109,10 @@  discard block
 block discarded – undo
109 109
 	 *
110 110
 	 * @param array $rules
111 111
 	 */
112
-	protected function split_rules( array &$rules ) {
112
+	protected function split_rules(array &$rules) {
113 113
 		// perhaps the $rules array structure should be validated here?...
114
-		$rules = array_map( function( $item ) {
115
-			return explode( '|', $item );
116
-		}, $rules );
114
+		$rules = array_map(function($item) {
115
+			return explode('|', $item);
116
+		}, $rules);
117 117
 	}
118 118
 }
Please login to merge, or discard this patch.
src/Artisan/Director.php 2 patches
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
    * @param string (optional) $identity
48 48
    */
49 49
   public function __construct( $identity = null ) {
50
-    $this->entity = $identity;
50
+	$this->entity = $identity;
51 51
   }
52 52
 
53 53
   /**
@@ -60,8 +60,8 @@  discard block
 block discarded – undo
60 60
    * @return self
61 61
    */
62 62
   public function describe( $attribute, $characteristic ) {
63
-    $this->scribe[ $attribute ] = $characteristic;
64
-    return $this;
63
+	$this->scribe[ $attribute ] = $characteristic;
64
+	return $this;
65 65
   }
66 66
 
67 67
   /**
@@ -73,10 +73,10 @@  discard block
 block discarded – undo
73 73
    * @return Composite
74 74
    */
75 75
   public function compose( ArtisanInterface $artisan ) {
76
-    $this->orchestrate( $this->aspect, $artisan );
77
-    return $artisan
78
-      ->create( $this->entity )
79
-      ->actualize();
76
+	$this->orchestrate( $this->aspect, $artisan );
77
+	return $artisan
78
+	  ->create( $this->entity )
79
+	  ->actualize();
80 80
   }
81 81
 
82 82
   /**
@@ -89,8 +89,8 @@  discard block
 block discarded – undo
89 89
    * @return self
90 90
    */
91 91
   public function with( $quality, $attributes = null ) {
92
-    $this->aspect[ $quality ] = $attributes;
93
-    return $this;
92
+	$this->aspect[ $quality ] = $attributes;
93
+	return $this;
94 94
   }
95 95
 
96 96
   /**
@@ -103,8 +103,8 @@  discard block
 block discarded – undo
103 103
    * @param ArtisanInterface $artisan
104 104
    */
105 105
   private function orchestrate( array $aspect, ArtisanInterface &$artisan ) {
106
-    foreach( $aspect as $component => $params ) {
107
-      $artisan->$component( $params );
108
-    }
106
+	foreach( $aspect as $component => $params ) {
107
+	  $artisan->$component( $params );
108
+	}
109 109
   }
110 110
 }
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 namespace WFV\Artisan;
3
-defined( 'ABSPATH' ) || die( 'envois' );
3
+defined('ABSPATH') || die('envois');
4 4
 
5 5
 use WFV\Contract\ArtisanInterface;
6 6
 
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
    *
47 47
    * @param string (optional) $identity
48 48
    */
49
-  public function __construct( $identity = null ) {
49
+  public function __construct($identity = null) {
50 50
     $this->entity = $identity;
51 51
   }
52 52
 
@@ -59,8 +59,8 @@  discard block
 block discarded – undo
59 59
    * @param mixed $characteristic
60 60
    * @return self
61 61
    */
62
-  public function describe( $attribute, $characteristic ) {
63
-    $this->scribe[ $attribute ] = $characteristic;
62
+  public function describe($attribute, $characteristic) {
63
+    $this->scribe[$attribute] = $characteristic;
64 64
     return $this;
65 65
   }
66 66
 
@@ -72,10 +72,10 @@  discard block
 block discarded – undo
72 72
    * @param ArtisanInterface $artisan
73 73
    * @return Composite
74 74
    */
75
-  public function compose( ArtisanInterface $artisan ) {
76
-    $this->orchestrate( $this->aspect, $artisan );
75
+  public function compose(ArtisanInterface $artisan) {
76
+    $this->orchestrate($this->aspect, $artisan);
77 77
     return $artisan
78
-      ->create( $this->entity )
78
+      ->create($this->entity)
79 79
       ->actualize();
80 80
   }
81 81
 
@@ -88,8 +88,8 @@  discard block
 block discarded – undo
88 88
    * @param string|array (optional) $attributes
89 89
    * @return self
90 90
    */
91
-  public function with( $quality, $attributes = null ) {
92
-    $this->aspect[ $quality ] = $attributes;
91
+  public function with($quality, $attributes = null) {
92
+    $this->aspect[$quality] = $attributes;
93 93
     return $this;
94 94
   }
95 95
 
@@ -102,9 +102,9 @@  discard block
 block discarded – undo
102 102
    * @param array $aspect
103 103
    * @param ArtisanInterface $artisan
104 104
    */
105
-  private function orchestrate( array $aspect, ArtisanInterface &$artisan ) {
106
-    foreach( $aspect as $component => $params ) {
107
-      $artisan->$component( $params );
105
+  private function orchestrate(array $aspect, ArtisanInterface&$artisan) {
106
+    foreach ($aspect as $component => $params) {
107
+      $artisan->$component($params);
108 108
     }
109 109
   }
110 110
 }
Please login to merge, or discard this patch.
src/Artisan/FormArtisan.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 namespace WFV\Artisan;
3
-defined( 'ABSPATH' ) || die();
3
+defined('ABSPATH') || die();
4 4
 
5 5
 use WFV\Contract\ArtisanInterface;
6 6
 use WFV\Collection\ErrorCollection;
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 	 *
60 60
 	 * @param array $config
61 61
 	 */
62
-	public function __construct( array $config ) {
62
+	public function __construct(array $config) {
63 63
 		$this->config = $config;
64 64
 	}
65 65
 
@@ -82,8 +82,8 @@  discard block
 block discarded – undo
82 82
 	 * @param string $action
83 83
 	 * @return WFV\Artisan\FormArtisan
84 84
 	 */
85
-	public function create( $action ) {
86
-		$this->form = new FormComposite( $this, $action );
85
+	public function create($action) {
86
+		$this->form = new FormComposite($this, $action);
87 87
 		return $this;
88 88
 	}
89 89
 
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 	 * @return WFV\Artisan\FormArtisan
97 97
 	 */
98 98
 	public function errors() {
99
-		$this->collection['errors'] = new ErrorCollection( $this->labels() );
99
+		$this->collection['errors'] = new ErrorCollection($this->labels());
100 100
 		return $this;
101 101
 	}
102 102
 
@@ -109,10 +109,10 @@  discard block
 block discarded – undo
109 109
 	 * @param array $data
110 110
 	 * @return WFV\Artisan\FormArtisan
111 111
 	 */
112
-	public function input( array $data = [] ) {
112
+	public function input(array $data = []) {
113 113
 		$input = $data[0];
114 114
 		$trim = $data[1];
115
-		$this->collection['input'] = new InputCollection( $input, $trim );
115
+		$this->collection['input'] = new InputCollection($input, $trim);
116 116
 		return $this;
117 117
 	}
118 118
 
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 	 * @return WFV\Artisan\FormArtisan
125 125
 	 */
126 126
 	public function messages() {
127
-		$this->collection['messages'] = new MessageCollection( $this->config );
127
+		$this->collection['messages'] = new MessageCollection($this->config);
128 128
 		return $this;
129 129
 	}
130 130
 
@@ -138,10 +138,10 @@  discard block
 block discarded – undo
138 138
 	 */
139 139
 	public function rules() {
140 140
 		$rules = array();
141
-		foreach( $this->config as $field => $options ) {
142
-			$rules[ $field ] = $options['rules'];
141
+		foreach ($this->config as $field => $options) {
142
+			$rules[$field] = $options['rules'];
143 143
 		}
144
-		$this->collection['rules'] = new RuleCollection( $rules );
144
+		$this->collection['rules'] = new RuleCollection($rules);
145 145
 		return $this;
146 146
 	}
147 147
 
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
 	 * @return array
169 169
 	 */
170 170
 	protected function labels() {
171
-		return array_map( function( $item ) {
171
+		return array_map(function($item) {
172 172
 			return $item['label'];
173 173
 		}, $this->config);
174 174
 	}
Please login to merge, or discard this patch.
src/Validators/AbstractValidator.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 namespace WFV\Validators;
3
-defined( 'ABSPATH' ) || die();
3
+defined('ABSPATH') || die();
4 4
 
5 5
 use \Respect\Validation\Validator as RespectValidator;
6 6
 use \Respect\Validation\Exceptions\NestedValidationException;
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 	 * @since 0.11.0
47 47
 	 *
48 48
 	 */
49
-	abstract protected function set_policy( $optional = false );
49
+	abstract protected function set_policy($optional = false);
50 50
 
51 51
 	/**
52 52
 	 *
@@ -54,11 +54,11 @@  discard block
 block discarded – undo
54 54
 	 * @since 0.11.0
55 55
 	 *
56 56
 	 */
57
-	public function __construct( $field ) {
57
+	public function __construct($field) {
58 58
 		$this->validator = new RespectValidator();
59 59
 		$this->field = $field;
60 60
 		$args = func_get_args();
61
-		$this->params = ( isset( $args[1] ) ) ? $args[1] : null;
61
+		$this->params = (isset($args[1])) ? $args[1] : null;
62 62
 	}
63 63
 
64 64
 	/**
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 	 *
91 91
 	 * @param
92 92
 	 */
93
-	public function set_message( $message ) {
93
+	public function set_message($message) {
94 94
 		$this->template['message'] = $message;
95 95
 	}
96 96
 
@@ -113,8 +113,8 @@  discard block
 block discarded – undo
113 113
 	 * @param string|array $value
114 114
 	 * @return bool
115 115
 	 */
116
-	public function validate( $value ) {
117
-		$is_valid = $this->validator->validate( $value );
116
+	public function validate($value) {
117
+		$is_valid = $this->validator->validate($value);
118 118
 		return $is_valid;
119 119
 	}
120 120
 }
Please login to merge, or discard this patch.