Completed
Push — master ( d2d9ba...e0ab63 )
by Maciej
8s
created
src/FormComposite.php 1 patch
Spacing   +16 added lines, -16 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\Artisan\FormArtisan;
6 6
 use WFV\Contract\ValidateInterface;
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 	 *
39 39
 	 * @param ArtisanInterface $builder
40 40
 	 */
41
-	public function __construct( FormArtisan $builder ) {
41
+	public function __construct(FormArtisan $builder) {
42 42
 		$this->alias = $builder->action;
43 43
 		$this->collection = $builder->collection;
44 44
 	}
@@ -52,8 +52,8 @@  discard block
 block discarded – undo
52 52
 	 * @param string $value Value to compare against.
53 53
 	 * @return string|null
54 54
 	 */
55
-	public function checked_if( $field = null, $value = null ) {
56
-		return $this->string_or_null( 'checked', $field, $value );
55
+	public function checked_if($field = null, $value = null) {
56
+		return $this->string_or_null('checked', $field, $value);
57 57
 	}
58 58
 
59 59
 	/**
@@ -67,8 +67,8 @@  discard block
 block discarded – undo
67 67
 	 * @param callable (optional) $callback
68 68
 	 * @return string
69 69
 	 */
70
-	public function display( $field = null, callable $callback = null ) {
71
-		echo $input = $this->utilize('input')->escape( $field );
70
+	public function display($field = null, callable $callback = null) {
71
+		echo $input = $this->utilize('input')->escape($field);
72 72
 		return $input;
73 73
 	}
74 74
 
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
 	 * @return bool
116 116
 	 */
117 117
 	public function is_valid() {
118
-		return ( $this->input()->is_populated() ) &&
118
+		return ($this->input()->is_populated()) &&
119 119
 			!$this->has_errors();
120 120
 	}
121 121
 
@@ -150,8 +150,8 @@  discard block
 block discarded – undo
150 150
 	 * @param string $value Value to compare against.
151 151
 	 * @return string|null
152 152
 	 */
153
-	public function selected_if( $field = null, $value = null ) {
154
-		return $this->string_or_null( 'selected', $field, $value );
153
+	public function selected_if($field = null, $value = null) {
154
+		return $this->string_or_null('selected', $field, $value);
155 155
 	}
156 156
 
157 157
 	/**
@@ -163,9 +163,9 @@  discard block
 block discarded – undo
163 163
 	 */
164 164
 	public function token_fields() {
165 165
 		// TODO - Move markup into something - perhaps a renderable interface?
166
-		$token_name = $this->alias . '_token';
167
-		echo $nonce_field = wp_nonce_field( $this->alias, $token_name, false, false );
168
-		echo $action_field = '<input type="hidden" name="action" value="'. $this->alias .'">';
166
+		$token_name = $this->alias.'_token';
167
+		echo $nonce_field = wp_nonce_field($this->alias, $token_name, false, false);
168
+		echo $action_field = '<input type="hidden" name="action" value="'.$this->alias.'">';
169 169
 	}
170 170
 
171 171
 	/**
@@ -179,9 +179,9 @@  discard block
 block discarded – undo
179 179
 	 * @param string (optional) $value
180 180
 	 * @return string|null
181 181
 	 */
182
-	protected function string_or_null( $response, $field = null, $value = null ) {
182
+	protected function string_or_null($response, $field = null, $value = null) {
183 183
 		$input = $this->utilize('input');
184
-		return ( $input->contains( $field, $value ) ) ? $response : null;
184
+		return ($input->contains($field, $value)) ? $response : null;
185 185
 	}
186 186
 
187 187
 	/**
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
 	 *
193 193
 	 * @param string $component Key indentifier.
194 194
 	 */
195
-	protected function utilize( $component ) {
196
-		return $this->collection[ $component ];
195
+	protected function utilize($component) {
196
+		return $this->collection[$component];
197 197
 	}
198 198
 }
Please login to merge, or discard this patch.