Completed
Push — master ( a94534...362609 )
by Maciej
13s
created
src/Abstraction/Composable.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\Abstraction;
3
-defined( 'ABSPATH' ) || die();
3
+defined('ABSPATH') || die();
4 4
 
5 5
 /**
6 6
  *
@@ -36,8 +36,8 @@  discard block
 block discarded – undo
36 36
 	 * @param string $name
37 37
 	 * @param class $collection
38 38
 	 */
39
-	protected function add_collection( $name, $collection ) {
40
-		$this->collection[ $name ] = $collection;
39
+	protected function add_collection($name, $collection) {
40
+		$this->collection[$name] = $collection;
41 41
 	}
42 42
 
43 43
 	/**
@@ -48,8 +48,8 @@  discard block
 block discarded – undo
48 48
 	 *
49 49
 	 * @param string $component Key indentifier.
50 50
 	 */
51
-	protected function utilize( $component ) {
52
-		return $this->collection[ $component ];
51
+	protected function utilize($component) {
52
+		return $this->collection[$component];
53 53
 	}
54 54
 
55 55
 	/**
@@ -60,9 +60,9 @@  discard block
 block discarded – undo
60 60
 	 *
61 61
 	 * @param array $collections
62 62
 	 */
63
-	protected function install( array $collections ) {
64
-		foreach( $collections as $name => $collection ) {
65
-			$this->add_collection( $name, $collection );
63
+	protected function install(array $collections) {
64
+		foreach ($collections as $name => $collection) {
65
+			$this->add_collection($name, $collection);
66 66
 		}
67 67
 	}
68 68
 }
Please login to merge, or discard this patch.
src/Contract/CollectionInterface.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 namespace WFV\Contract;
3
-defined( 'ABSPATH' ) || die();
3
+defined('ABSPATH') || die();
4 4
 
5 5
 /**
6 6
  *
@@ -12,12 +12,12 @@  discard block
 block discarded – undo
12 12
 	/**
13 13
 	 * @return bool
14 14
 	 */
15
-	public function contains( $key = null, $value = null );
15
+	public function contains($key = null, $value = null);
16 16
 
17 17
 	/**
18 18
 	 * @return bool
19 19
 	 */
20
-	public function has( $key = null );
20
+	public function has($key = null);
21 21
 
22 22
 	/**
23 23
 	 * @return bool
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 	/**
28 28
 	 * @return string|null
29 29
 	 */
30
-	public function escape( $key, callable $callback = null );
30
+	public function escape($key, callable $callback = null);
31 31
 
32 32
 	/**
33 33
 	 * @return
Please login to merge, or discard this patch.
src/Contract/ArtisanInterface.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 namespace WFV\Contract;
3
-defined( 'ABSPATH' ) || die();
3
+defined('ABSPATH') || die();
4 4
 
5 5
 /**
6 6
  *
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
 	/**
14 14
 	 * @return
15 15
 	 */
16
-	public function create( $action );
16
+	public function create($action);
17 17
 
18 18
 	/**
19 19
 	 * @return
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/Artisan/Director.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( '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/Agent/InspectionAgent.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\Agent;
3
-defined( 'ABSPATH' ) || die();
3
+defined('ABSPATH') || die();
4 4
 
5 5
 
6 6
 /**
@@ -35,9 +35,9 @@  discard block
 block discarded – undo
35 35
 	 *
36 36
 	 * @param string $action
37 37
 	 */
38
-	public function __construct( $action ) {
38
+	public function __construct($action) {
39 39
 		$this->action = $action;
40
-		$this->token = wp_create_nonce( $action );
40
+		$this->token = wp_create_nonce($action);
41 41
 	}
42 42
 
43 43
 	/**
@@ -50,8 +50,8 @@  discard block
 block discarded – undo
50 50
 	 * @return bool
51 51
 	 */
52 52
 	public function safe_submit() {
53
-		if( $this->submit_has_action() ) {
54
-			return ( $_POST['action'] === $this->action ) ? $this->nonce() : false;
53
+		if ($this->submit_has_action()) {
54
+			return ($_POST['action'] === $this->action) ? $this->nonce() : false;
55 55
 		}
56 56
 		return false;
57 57
 	}
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 	 * @return bool
65 65
 	 */
66 66
 	private function submit_has_action() {
67
-		return isset( $_POST['action'] );
67
+		return isset($_POST['action']);
68 68
 	}
69 69
 
70 70
 	/**
@@ -76,8 +76,8 @@  discard block
 block discarded – undo
76 76
 	 * @return bool
77 77
 	 */
78 78
 	private function nonce() {
79
-		$nonce = $_REQUEST[ $this->action.'_token' ];
80
-		return ( wp_verify_nonce( $nonce, $this->action ) ) ? true : false;
79
+		$nonce = $_REQUEST[$this->action.'_token'];
80
+		return (wp_verify_nonce($nonce, $this->action)) ? true : false;
81 81
 	}
82 82
 
83 83
 }
Please login to merge, or discard this patch.