@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | */ |
23 | 23 | public function assetPath( $asset ) |
24 | 24 | { |
25 | - return $this->paths( 'dir.stylesheet' ) . 'assets/' . $asset; |
|
25 | + return $this->paths( 'dir.stylesheet' ).'assets/'.$asset; |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | /** |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | */ |
33 | 33 | public function assetUri( $asset ) |
34 | 34 | { |
35 | - return $this->paths( 'uri.stylesheet' ) . 'assets/' . $asset; |
|
35 | + return $this->paths( 'uri.stylesheet' ).'assets/'.$asset; |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | /** |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | */ |
41 | 41 | public function copyright() |
42 | 42 | { |
43 | - return __( 'Copyright', 'castor' ) . ' © ' . date( 'Y' ) . ', ' . get_bloginfo( 'name' ); |
|
43 | + return __( 'Copyright', 'castor' ).' © '.date( 'Y' ).', '.get_bloginfo( 'name' ); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | /** |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | */ |
67 | 67 | public function imagePath( $asset ) |
68 | 68 | { |
69 | - return $this->paths( 'dir.stylesheet' ) . 'assets/img/' . $asset; |
|
69 | + return $this->paths( 'dir.stylesheet' ).'assets/img/'.$asset; |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | /** |
@@ -76,14 +76,14 @@ discard block |
||
76 | 76 | */ |
77 | 77 | public function imageUri( $asset ) |
78 | 78 | { |
79 | - return $this->paths( 'uri.stylesheet' ) . 'assets/img/' . $asset; |
|
79 | + return $this->paths( 'uri.stylesheet' ).'assets/img/'.$asset; |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | public function pageTitle() |
83 | 83 | { |
84 | 84 | foreach( ['is_404', 'is_archive', 'is_home', 'is_page', 'is_search'] as $bool ) { |
85 | 85 | if( !$bool() )continue; |
86 | - $method = sprintf( 'get%sTitle', ucfirst( str_replace( 'is_', '', $bool ))); |
|
86 | + $method = sprintf( 'get%sTitle', ucfirst( str_replace( 'is_', '', $bool ) ) ); |
|
87 | 87 | return $this->$method(); |
88 | 88 | } |
89 | 89 | |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | 'uri.template' => get_template_directory_uri(), |
106 | 106 | ]; |
107 | 107 | |
108 | - if( is_null( $path )) { |
|
108 | + if( is_null( $path ) ) { |
|
109 | 109 | return $paths; |
110 | 110 | } |
111 | 111 | |
@@ -121,8 +121,8 @@ discard block |
||
121 | 121 | */ |
122 | 122 | public function svg( $path = null ) |
123 | 123 | { |
124 | - if( file_exists( $this->imagePath( $path ))) { |
|
125 | - return file_get_contents( $this->imagePath( $path )); |
|
124 | + if( file_exists( $this->imagePath( $path ) ) ) { |
|
125 | + return file_get_contents( $this->imagePath( $path ) ); |
|
126 | 126 | } |
127 | 127 | } |
128 | 128 | |
@@ -133,12 +133,12 @@ discard block |
||
133 | 133 | |
134 | 134 | protected function getArchiveTitle() |
135 | 135 | { |
136 | - return $this->archiveMeta->get( 'title', get_the_archive_title(), get_query_var( 'post_type' )); |
|
136 | + return $this->archiveMeta->get( 'title', get_the_archive_title(), get_query_var( 'post_type' ) ); |
|
137 | 137 | } |
138 | 138 | |
139 | 139 | protected function getHomeTitle() |
140 | 140 | { |
141 | - return ( $home = (string) get_option( 'page_for_posts' )) |
|
141 | + return ( $home = (string) get_option( 'page_for_posts' ) ) |
|
142 | 142 | ? get_the_title( $home ) |
143 | 143 | : __( 'Latest Posts', 'castor' ); |
144 | 144 | } |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | { |
148 | 148 | return $this->postMeta->get( 'title', [ |
149 | 149 | 'fallback' => get_the_title(), |
150 | - ]); |
|
150 | + ] ); |
|
151 | 151 | } |
152 | 152 | |
153 | 153 | protected function getSearchTitle() |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | public function buildAttributesFor( $tag, array $atts = [] ) |
23 | 23 | { |
24 | 24 | return $this->buildAttributes( |
25 | - wp_parse_args( $atts, apply_filters( "castor/render/$tag/attributes", [] )) |
|
25 | + wp_parse_args( $atts, apply_filters( "castor/render/$tag/attributes", [] ) ) |
|
26 | 26 | ); |
27 | 27 | } |
28 | 28 | |
@@ -34,11 +34,11 @@ discard block |
||
34 | 34 | */ |
35 | 35 | public function buildClassName( $name, $path = '' ) |
36 | 36 | { |
37 | - $className = array_map( 'ucfirst', array_map( 'strtolower', (array) preg_split( '/[-_]/', $name ))); |
|
37 | + $className = array_map( 'ucfirst', array_map( 'strtolower', (array) preg_split( '/[-_]/', $name ) ) ); |
|
38 | 38 | $className = implode( '', $className ); |
39 | 39 | |
40 | 40 | return !empty( $path ) |
41 | - ? str_replace( '\\\\', '\\', sprintf( '%s\%s', $path, $className )) |
|
41 | + ? str_replace( '\\\\', '\\', sprintf( '%s\%s', $path, $className ) ) |
|
42 | 42 | : $className; |
43 | 43 | } |
44 | 44 | |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | */ |
51 | 51 | public function buildMethodName( $name, $prefix = 'get' ) |
52 | 52 | { |
53 | - return lcfirst( $this->buildClassName( $prefix . '-' . $name )); |
|
53 | + return lcfirst( $this->buildClassName( $prefix.'-'.$name ) ); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | /** |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | { |
76 | 76 | return $unique && $this->endsWith( $suffix, $string ) |
77 | 77 | ? $string |
78 | - : $string . $suffix; |
|
78 | + : $string.$suffix; |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | /** |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | $attributes = $this->buildAttributesFor( $tag, $attributes ); |
104 | 104 | |
105 | 105 | printf( '<%s>%s</%s>', |
106 | - rtrim( sprintf( '%s %s', $tag, $attributes )), |
|
106 | + rtrim( sprintf( '%s %s', $tag, $attributes ) ), |
|
107 | 107 | $value, |
108 | 108 | $tag |
109 | 109 | ); |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | { |
121 | 121 | return $unique && $this->startsWith( $prefix, $string ) |
122 | 122 | ? $string |
123 | - : $prefix . $string; |
|
123 | + : $prefix.$string; |
|
124 | 124 | } |
125 | 125 | |
126 | 126 | /** |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | */ |
132 | 132 | public function startsWith( $needle, $haystack ) |
133 | 133 | { |
134 | - return substr( $haystack, 0, strlen( $needle )) === $needle; |
|
134 | + return substr( $haystack, 0, strlen( $needle ) ) === $needle; |
|
135 | 135 | } |
136 | 136 | |
137 | 137 | /** |
@@ -141,10 +141,10 @@ discard block |
||
141 | 141 | */ |
142 | 142 | public function toArray( $value ) |
143 | 143 | { |
144 | - if( is_string( $value )) { |
|
144 | + if( is_string( $value ) ) { |
|
145 | 145 | $value = trim( $value ); |
146 | 146 | } |
147 | - return array_filter((array) $value ); |
|
147 | + return array_filter( (array) $value ); |
|
148 | 148 | } |
149 | 149 | |
150 | 150 | /** |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | { |
159 | 159 | $strPos = $caseSensitive ? "strpos" : "stripos"; |
160 | 160 | if( $strPos( $string, $needle ) === 0 ) { |
161 | - $string = substr( $string, strlen( $needle )); |
|
161 | + $string = substr( $string, strlen( $needle ) ); |
|
162 | 162 | } |
163 | 163 | return $string; |
164 | 164 | } |
@@ -173,8 +173,8 @@ discard block |
||
173 | 173 | public function trimRight( $string, $needle, $caseSensitive = true ) |
174 | 174 | { |
175 | 175 | $strPos = $caseSensitive ? "strpos" : "stripos"; |
176 | - if( $strPos( $string, $needle, strlen( $string ) - strlen( $needle )) !== false ) { |
|
177 | - $string = substr( $string, 0, -strlen( $needle )); |
|
176 | + if( $strPos( $string, $needle, strlen( $string ) - strlen( $needle ) ) !== false ) { |
|
177 | + $string = substr( $string, 0, -strlen( $needle ) ); |
|
178 | 178 | } |
179 | 179 | return $string; |
180 | 180 | } |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | foreach( $rules as $rule ) { |
79 | 79 | $this->validateAttribute( $rule, $attribute ); |
80 | 80 | |
81 | - if( $this->shouldStopValidating( $attribute ))break; |
|
81 | + if( $this->shouldStopValidating( $attribute ) )break; |
|
82 | 82 | } |
83 | 83 | } |
84 | 84 | |
@@ -97,10 +97,10 @@ discard block |
||
97 | 97 | { |
98 | 98 | $message = $this->getMessage( $attribute, $rule, $parameters ); |
99 | 99 | |
100 | - $this->errors[ $attribute ]['errors'][] = $message; |
|
100 | + $this->errors[$attribute]['errors'][] = $message; |
|
101 | 101 | |
102 | - if( !isset( $this->errors[ $attribute ]['value'] )) { |
|
103 | - $this->errors[ $attribute ]['value'] = $this->getValue( $attribute ); |
|
102 | + if( !isset( $this->errors[$attribute]['value'] ) ) { |
|
103 | + $this->errors[$attribute]['value'] = $this->getValue( $attribute ); |
|
104 | 104 | } |
105 | 105 | } |
106 | 106 | |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | { |
117 | 117 | $this->addError( $attribute, $rule, $parameters ); |
118 | 118 | |
119 | - $this->failedRules[ $attribute ][ $rule ] = $parameters; |
|
119 | + $this->failedRules[$attribute][$rule] = $parameters; |
|
120 | 120 | } |
121 | 121 | |
122 | 122 | /** |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | */ |
143 | 143 | protected function getMessage( $attribute, $rule, array $parameters ) |
144 | 144 | { |
145 | - if( in_array( $rule, $this->sizeRules )) { |
|
145 | + if( in_array( $rule, $this->sizeRules ) ) { |
|
146 | 146 | return $this->getSizeMessage( $attribute, $rule, $parameters ); |
147 | 147 | } |
148 | 148 | |
@@ -161,15 +161,15 @@ discard block |
||
161 | 161 | */ |
162 | 162 | protected function getRule( $attribute, $rules ) |
163 | 163 | { |
164 | - if( !array_key_exists( $attribute, $this->rules ))return; |
|
164 | + if( !array_key_exists( $attribute, $this->rules ) )return; |
|
165 | 165 | |
166 | 166 | $rules = (array) $rules; |
167 | 167 | |
168 | - foreach( $this->rules[ $attribute ] as $rule ) { |
|
168 | + foreach( $this->rules[$attribute] as $rule ) { |
|
169 | 169 | list( $rule, $parameters ) = $this->parseRule( $rule ); |
170 | 170 | |
171 | - if( in_array( $rule, $rules )) { |
|
172 | - return [ $rule, $parameters ]; |
|
171 | + if( in_array( $rule, $rules ) ) { |
|
172 | + return [$rule, $parameters]; |
|
173 | 173 | } |
174 | 174 | } |
175 | 175 | } |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | if( is_numeric( $value ) && $hasNumeric ) { |
190 | 190 | return $value; |
191 | 191 | } |
192 | - elseif( is_array( $value )) { |
|
192 | + elseif( is_array( $value ) ) { |
|
193 | 193 | return count( $value ); |
194 | 194 | } |
195 | 195 | |
@@ -223,8 +223,8 @@ discard block |
||
223 | 223 | */ |
224 | 224 | protected function getValue( $attribute ) |
225 | 225 | { |
226 | - if( isset( $this->data[ $attribute ] )) { |
|
227 | - return $this->data[ $attribute ]; |
|
226 | + if( isset( $this->data[$attribute] ) ) { |
|
227 | + return $this->data[$attribute]; |
|
228 | 228 | } |
229 | 229 | } |
230 | 230 | |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | */ |
239 | 239 | protected function hasRule( $attribute, $rules ) |
240 | 240 | { |
241 | - return !is_null( $this->getRule( $attribute, $rules )); |
|
241 | + return !is_null( $this->getRule( $attribute, $rules ) ); |
|
242 | 242 | } |
243 | 243 | |
244 | 244 | /** |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | protected function normalizeData( $data ) |
252 | 252 | { |
253 | 253 | // If an object was provided, get its public properties |
254 | - if( is_object( $data )) { |
|
254 | + if( is_object( $data ) ) { |
|
255 | 255 | $this->data = get_object_vars( $data ); |
256 | 256 | } |
257 | 257 | else { |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | protected function parseParameters( $rule, $parameter ) |
273 | 273 | { |
274 | 274 | if( strtolower( $rule ) == 'regex' ) { |
275 | - return [ $parameter ]; |
|
275 | + return [$parameter]; |
|
276 | 276 | } |
277 | 277 | |
278 | 278 | return str_getcsv( $parameter ); |
@@ -297,10 +297,10 @@ discard block |
||
297 | 297 | $parameters = $this->parseParameters( $rule, $parameter ); |
298 | 298 | } |
299 | 299 | |
300 | - $rule = ucwords( str_replace( ['-', '_'], ' ', trim( $rule ))); |
|
300 | + $rule = ucwords( str_replace( ['-', '_'], ' ', trim( $rule ) ) ); |
|
301 | 301 | $rule = str_replace( ' ', '', $rule ); |
302 | 302 | |
303 | - return [ $rule, $parameters ]; |
|
303 | + return [$rule, $parameters]; |
|
304 | 304 | } |
305 | 305 | |
306 | 306 | /** |
@@ -312,7 +312,7 @@ discard block |
||
312 | 312 | */ |
313 | 313 | protected function replaceBetween( $message, array $parameters ) |
314 | 314 | { |
315 | - return str_replace([':min', ':max'], $parameters, $message ); |
|
315 | + return str_replace( [':min', ':max'], $parameters, $message ); |
|
316 | 316 | } |
317 | 317 | |
318 | 318 | /** |
@@ -363,7 +363,7 @@ discard block |
||
363 | 363 | protected function setRules( array $rules ) |
364 | 364 | { |
365 | 365 | foreach( $rules as $key => $rule ) { |
366 | - $rules[ $key ] = is_string( $rule ) ? explode( '|', $rule ) : $rule; |
|
366 | + $rules[$key] = is_string( $rule ) ? explode( '|', $rule ) : $rule; |
|
367 | 367 | } |
368 | 368 | |
369 | 369 | $this->rules = $rules; |
@@ -381,8 +381,8 @@ discard block |
||
381 | 381 | protected function shouldStopValidating( $attribute ) |
382 | 382 | { |
383 | 383 | return $this->hasRule( $attribute, $this->implicitRules ) |
384 | - && isset( $this->failedRules[ $attribute ] ) |
|
385 | - && array_intersect( array_keys( $this->failedRules[ $attribute ] ), $this->implicitRules ); |
|
384 | + && isset( $this->failedRules[$attribute] ) |
|
385 | + && array_intersect( array_keys( $this->failedRules[$attribute] ), $this->implicitRules ); |
|
386 | 386 | } |
387 | 387 | |
388 | 388 | /** |
@@ -394,7 +394,7 @@ discard block |
||
394 | 394 | */ |
395 | 395 | protected function snakeCase( $string ) |
396 | 396 | { |
397 | - if( !ctype_lower( $string )) { |
|
397 | + if( !ctype_lower( $string ) ) { |
|
398 | 398 | $string = preg_replace( '/\s+/u', '', $string ); |
399 | 399 | $string = preg_replace( '/(.)(?=[A-Z])/u', '$1_', $string ); |
400 | 400 | $string = mb_strtolower( $string, 'UTF-8' ); |
@@ -414,7 +414,7 @@ discard block |
||
414 | 414 | */ |
415 | 415 | protected function translator( $key, $rule, $attribute, array $parameters ) |
416 | 416 | { |
417 | - $strings = [];//glsr_resolve( 'Strings' )->validation(); |
|
417 | + $strings = []; //glsr_resolve( 'Strings' )->validation(); |
|
418 | 418 | |
419 | 419 | $message = isset( $strings[$key] ) |
420 | 420 | ? $strings[$key] |
@@ -424,7 +424,7 @@ discard block |
||
424 | 424 | |
425 | 425 | $message = str_replace( ':attribute', $attribute, $message ); |
426 | 426 | |
427 | - if( method_exists( $this, $replacer = "replace{$rule}" )) { |
|
427 | + if( method_exists( $this, $replacer = "replace{$rule}" ) ) { |
|
428 | 428 | $message = $this->$replacer( $message, $parameters ); |
429 | 429 | } |
430 | 430 | |
@@ -467,11 +467,11 @@ discard block |
||
467 | 467 | |
468 | 468 | $method = "validate{$rule}"; |
469 | 469 | |
470 | - if( !method_exists( $this, $method )) { |
|
470 | + if( !method_exists( $this, $method ) ) { |
|
471 | 471 | throw new BadMethodCallException( "Method [$method] does not exist." ); |
472 | 472 | } |
473 | 473 | |
474 | - if( !$this->$method( $this->getValue( $attribute ), $attribute, $parameters )) { |
|
474 | + if( !$this->$method( $this->getValue( $attribute ), $attribute, $parameters ) ) { |
|
475 | 475 | $this->addFailure( $attribute, $rule, $parameters ); |
476 | 476 | } |
477 | 477 | } |
@@ -556,7 +556,7 @@ discard block |
||
556 | 556 | */ |
557 | 557 | protected function validateRequired( $value ) |
558 | 558 | { |
559 | - if( is_string( $value )) { |
|
559 | + if( is_string( $value ) ) { |
|
560 | 560 | $value = trim( $value ); |
561 | 561 | } |
562 | 562 | return is_null( $value ) || empty( $value ) |
@@ -5,8 +5,7 @@ discard block |
||
5 | 5 | use BadMethodCallException; |
6 | 6 | use InvalidArgumentException; |
7 | 7 | |
8 | -class Validator |
|
9 | -{ |
|
8 | +class Validator { |
|
10 | 9 | /** |
11 | 10 | * @var array |
12 | 11 | */ |
@@ -78,7 +77,9 @@ discard block |
||
78 | 77 | foreach( $rules as $rule ) { |
79 | 78 | $this->validateAttribute( $rule, $attribute ); |
80 | 79 | |
81 | - if( $this->shouldStopValidating( $attribute ))break; |
|
80 | + if( $this->shouldStopValidating( $attribute )) { |
|
81 | + break; |
|
82 | + } |
|
82 | 83 | } |
83 | 84 | } |
84 | 85 | |
@@ -161,7 +162,9 @@ discard block |
||
161 | 162 | */ |
162 | 163 | protected function getRule( $attribute, $rules ) |
163 | 164 | { |
164 | - if( !array_key_exists( $attribute, $this->rules ))return; |
|
165 | + if( !array_key_exists( $attribute, $this->rules )) { |
|
166 | + return; |
|
167 | + } |
|
165 | 168 | |
166 | 169 | $rules = (array) $rules; |
167 | 170 | |
@@ -420,7 +423,9 @@ discard block |
||
420 | 423 | ? $strings[$key] |
421 | 424 | : false; |
422 | 425 | |
423 | - if( !$message )return; |
|
426 | + if( !$message ) { |
|
427 | + return; |
|
428 | + } |
|
424 | 429 | |
425 | 430 | $message = str_replace( ':attribute', $attribute, $message ); |
426 | 431 | |
@@ -463,7 +468,9 @@ discard block |
||
463 | 468 | { |
464 | 469 | list( $rule, $parameters ) = $this->parseRule( $rule ); |
465 | 470 | |
466 | - if( $rule == '' )return; |
|
471 | + if( $rule == '' ) { |
|
472 | + return; |
|
473 | + } |
|
467 | 474 | |
468 | 475 | $method = "validate{$rule}"; |
469 | 476 |
@@ -5,8 +5,7 @@ discard block |
||
5 | 5 | use GeminiLabs\Castor\Helpers\Template; |
6 | 6 | use PHPMailer; |
7 | 7 | |
8 | -class Email |
|
9 | -{ |
|
8 | +class Email { |
|
10 | 9 | /** |
11 | 10 | * @var Template |
12 | 11 | */ |
@@ -56,7 +55,9 @@ discard block |
||
56 | 55 | $this->to = $email['to']; |
57 | 56 | |
58 | 57 | add_action( 'phpmailer_init', function( PHPMailer $phpmailer ) { |
59 | - if( $phpmailer->ContentType === 'text/plain' || !empty( $phpmailer->AltBody ))return; |
|
58 | + if( $phpmailer->ContentType === 'text/plain' || !empty( $phpmailer->AltBody )) { |
|
59 | + return; |
|
60 | + } |
|
60 | 61 | $phpmailer->AltBody = $this->buildPlainTextMessage( $phpmailer->Body ); |
61 | 62 | }); |
62 | 63 | |
@@ -80,7 +81,9 @@ discard block |
||
80 | 81 | */ |
81 | 82 | public function send() |
82 | 83 | { |
83 | - if( !$this->message || !$this->subject || !$this->to )return; |
|
84 | + if( !$this->message || !$this->subject || !$this->to ) { |
|
85 | + return; |
|
86 | + } |
|
84 | 87 | |
85 | 88 | $sent = wp_mail( |
86 | 89 | $this->to, |
@@ -210,7 +213,9 @@ discard block |
||
210 | 213 | if( !file_exists( $file )) { |
211 | 214 | $file = sprintf( '%s/templates/%s.php', dirname( __DIR__ ), $templatePath ); |
212 | 215 | } |
213 | - if( !file_exists( $file ))return; |
|
216 | + if( !file_exists( $file )) { |
|
217 | + return; |
|
218 | + } |
|
214 | 219 | |
215 | 220 | ob_start(); |
216 | 221 | include $file; |
@@ -5,8 +5,7 @@ discard block |
||
5 | 5 | use Exception; |
6 | 6 | use ReflectionException; |
7 | 7 | |
8 | -class Field |
|
9 | -{ |
|
8 | +class Field { |
|
10 | 9 | /** |
11 | 10 | * @var array |
12 | 11 | */ |
@@ -119,7 +118,9 @@ discard block |
||
119 | 118 | */ |
120 | 119 | public function render( $print = true ) |
121 | 120 | { |
122 | - if( $this->args['render'] === false )return; |
|
121 | + if( $this->args['render'] === false ) { |
|
122 | + return; |
|
123 | + } |
|
123 | 124 | |
124 | 125 | $field = $this->getField(); |
125 | 126 | |
@@ -203,7 +204,9 @@ discard block |
||
203 | 204 | $attributes = (array) $args['attributes']; |
204 | 205 | |
205 | 206 | foreach( $attributes as $key => $value ) { |
206 | - if( is_string( $key ))continue; |
|
207 | + if( is_string( $key )) { |
|
208 | + continue; |
|
209 | + } |
|
207 | 210 | unset( $attributes[ $key ] ); |
208 | 211 | if( !isset( $attributes[ $value ] )) { |
209 | 212 | $attributes[ $value ] = ''; |
@@ -220,7 +223,9 @@ discard block |
||
220 | 223 | */ |
221 | 224 | protected function parseId( array $args ) |
222 | 225 | { |
223 | - if( isset( $args['id'] ) && !$args['id'] )return; |
|
226 | + if( isset( $args['id'] ) && !$args['id'] ) { |
|
227 | + return; |
|
228 | + } |
|
224 | 229 | |
225 | 230 | !$args['suffix'] ?: $args['suffix'] = "-{$args['suffix']}"; |
226 | 231 | |
@@ -332,7 +337,9 @@ discard block |
||
332 | 337 | */ |
333 | 338 | protected function setDataDepends() |
334 | 339 | { |
335 | - if( !( $depends = $this->args['depends'] ))return; |
|
340 | + if( !( $depends = $this->args['depends'] )) { |
|
341 | + return; |
|
342 | + } |
|
336 | 343 | |
337 | 344 | $name = $depends; |
338 | 345 | $value = true; |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | case 'outside': |
60 | 60 | return $this->$property; |
61 | 61 | } |
62 | - throw new Exception( sprintf( 'Invalid %s property: %s', __CLASS__, $property )); |
|
62 | + throw new Exception( sprintf( 'Invalid %s property: %s', __CLASS__, $property ) ); |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | /** |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | */ |
86 | 86 | public function generateLabel() |
87 | 87 | { |
88 | - if( empty( $this->args['label'] ))return; |
|
88 | + if( empty( $this->args['label'] ) )return; |
|
89 | 89 | |
90 | 90 | $for = !!$this->args['id'] |
91 | 91 | ? " for=\"{$this->args['id']}\"" |
@@ -110,9 +110,9 @@ discard block |
||
110 | 110 | */ |
111 | 111 | protected function camelCase( $value ) |
112 | 112 | { |
113 | - $value = ucwords( str_replace( ['-', '_'], ' ', $value )); |
|
113 | + $value = ucwords( str_replace( ['-', '_'], ' ', $value ) ); |
|
114 | 114 | |
115 | - return lcfirst( str_replace( ' ', '', $value )); |
|
115 | + return lcfirst( str_replace( ' ', '', $value ) ); |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | /** |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | |
145 | 145 | if( $method === 'singleInput' ) { |
146 | 146 | |
147 | - if( !isset( $this->args['options'] ) || empty( $this->args['options'] ))return; |
|
147 | + if( !isset( $this->args['options'] ) || empty( $this->args['options'] ) )return; |
|
148 | 148 | |
149 | 149 | // hack to make sure unset single checkbox values start at 1 instead of 0 |
150 | 150 | if( key( $this->args['options'] ) === 0 ) { |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | |
174 | 174 | $normalize = new Normalizer; |
175 | 175 | |
176 | - return ( $this->element && method_exists( $normalize, $this->element )) |
|
176 | + return ( $this->element && method_exists( $normalize, $this->element ) ) |
|
177 | 177 | ? $normalize->{$this->element}( $args, $implode ) |
178 | 178 | : ( !!$implode ? '' : [] ); |
179 | 179 | } |
@@ -187,8 +187,8 @@ discard block |
||
187 | 187 | { |
188 | 188 | // similar to array_merge except overwrite empty values |
189 | 189 | foreach( $defaults as $key => $value ) { |
190 | - if( isset( $this->args[ $key ] ) && !empty( $this->args[ $key ] ))continue; |
|
191 | - $this->args[ $key ] = $value; |
|
190 | + if( isset( $this->args[$key] ) && !empty( $this->args[$key] ) )continue; |
|
191 | + $this->args[$key] = $value; |
|
192 | 192 | } |
193 | 193 | |
194 | 194 | $attributes = $this->args['attributes']; |
@@ -246,13 +246,13 @@ discard block |
||
246 | 246 | |
247 | 247 | $args = []; |
248 | 248 | |
249 | - $value = $this->args['options'][ $optionName ]; |
|
249 | + $value = $this->args['options'][$optionName]; |
|
250 | 250 | |
251 | - if( is_array( $value )) { |
|
251 | + if( is_array( $value ) ) { |
|
252 | 252 | $args = $value; |
253 | 253 | } |
254 | 254 | |
255 | - if( is_string( $value )) { |
|
255 | + if( is_string( $value ) ) { |
|
256 | 256 | $label = $value; |
257 | 257 | } |
258 | 258 | |
@@ -263,15 +263,15 @@ discard block |
||
263 | 263 | |
264 | 264 | if( !isset( $label ) || $args['name'] === '' )return; |
265 | 265 | |
266 | - $args['id'] = $this->args['id'] . "-{$number}"; |
|
267 | - $args['name'] = $this->args['name'] . ( $type === 'checkbox' && $this->multi ? '[]' : '' ); |
|
266 | + $args['id'] = $this->args['id']."-{$number}"; |
|
267 | + $args['name'] = $this->args['name'].( $type === 'checkbox' && $this->multi ? '[]' : '' ); |
|
268 | 268 | |
269 | 269 | $args = array_filter( $args, function( $value ) { |
270 | 270 | return $value !== ''; |
271 | 271 | }); |
272 | 272 | |
273 | - if( is_array( $this->args['value'] )) { |
|
274 | - if( in_array( $args['value'], $this->args['value'] )) { |
|
273 | + if( is_array( $this->args['value'] ) ) { |
|
274 | + if( in_array( $args['value'], $this->args['value'] ) ) { |
|
275 | 275 | $this->args['default'] = $args['value']; |
276 | 276 | } |
277 | 277 | } |
@@ -314,7 +314,7 @@ discard block |
||
314 | 314 | return sprintf( '<option value="%s"%s>%s</option>', |
315 | 315 | $optionKey, |
316 | 316 | selected( $this->args['value'], $optionKey, false ), |
317 | - $this->args['options'][ $optionKey ] |
|
317 | + $this->args['options'][$optionKey] |
|
318 | 318 | ); |
319 | 319 | } |
320 | 320 |