@@ -185,8 +185,7 @@ |
||
| 185 | 185 | { |
| 186 | 186 | try { |
| 187 | 187 | return $this->make( $parameter->getClass()->name ); |
| 188 | - } |
|
| 189 | - catch( BindingResolutionException $e ) { |
|
| 188 | + } catch( BindingResolutionException $e ) { |
|
| 190 | 189 | if( $parameter->isOptional() ) { |
| 191 | 190 | return $parameter->getDefaultValue(); |
| 192 | 191 | } |
@@ -72,7 +72,9 @@ |
||
| 72 | 72 | public function pageTitle() |
| 73 | 73 | { |
| 74 | 74 | foreach( ['is_404', 'is_archive', 'is_home', 'is_page', 'is_search'] as $bool ) { |
| 75 | - if( !$bool() )continue; |
|
| 75 | + if( !$bool() ) { |
|
| 76 | + continue; |
|
| 77 | + } |
|
| 76 | 78 | $method = sprintf( 'get%sTitle', ucfirst( str_replace( 'is_', '', $bool ))); |
| 77 | 79 | return $this->$method(); |
| 78 | 80 | } |
@@ -59,7 +59,9 @@ |
||
| 59 | 59 | |
| 60 | 60 | $attachment = get_post( $attachmentId ); |
| 61 | 61 | |
| 62 | - if( is_null( $attachment ) || $attachment->post_type != 'attachment' )return; |
|
| 62 | + if( is_null( $attachment ) || $attachment->post_type != 'attachment' ) { |
|
| 63 | + return; |
|
| 64 | + } |
|
| 63 | 65 | |
| 64 | 66 | return $attachment->ID; |
| 65 | 67 | } |
@@ -41,7 +41,9 @@ discard block |
||
| 41 | 41 | |
| 42 | 42 | public function render() |
| 43 | 43 | { |
| 44 | - if( !isset( $this->video->html ))return; |
|
| 44 | + if( !isset( $this->video->html )) { |
|
| 45 | + return; |
|
| 46 | + } |
|
| 45 | 47 | return sprintf( |
| 46 | 48 | '<div class="video embed">%s%s</div>', |
| 47 | 49 | $this->renderScreenshot(), |
@@ -114,7 +116,9 @@ discard block |
||
| 114 | 116 | |
| 115 | 117 | foreach( $this->args as $key => $value ) { |
| 116 | 118 | $method = $this->utility->buildMethodName( $key, 'set' ); |
| 117 | - if( !method_exists( $this, $method ))continue; |
|
| 119 | + if( !method_exists( $this, $method )) { |
|
| 120 | + continue; |
|
| 121 | + } |
|
| 118 | 122 | call_user_func([ $this, $method ], $value ); |
| 119 | 123 | } |
| 120 | 124 | return $this->args; |
@@ -37,8 +37,12 @@ |
||
| 37 | 37 | 'width' => 1280, |
| 38 | 38 | 'height' => 1280, |
| 39 | 39 | ]); |
| 40 | - if( $request === false )return; |
|
| 41 | - if( !empty( $args['embed_type'] ) && $args['embed_type'] != $request->type )return; |
|
| 40 | + if( $request === false ) { |
|
| 41 | + return; |
|
| 42 | + } |
|
| 43 | + if( !empty( $args['embed_type'] ) && $args['embed_type'] != $request->type ) { |
|
| 44 | + return; |
|
| 45 | + } |
|
| 42 | 46 | return $this->modifyRequest( $request, $args ); |
| 43 | 47 | } |
| 44 | 48 | |
@@ -62,7 +62,9 @@ discard block |
||
| 62 | 62 | $this->to = $email['to']; |
| 63 | 63 | |
| 64 | 64 | add_action( 'phpmailer_init', function( PHPMailer $phpmailer ) { |
| 65 | - if( $phpmailer->ContentType === 'text/plain' || !empty( $phpmailer->AltBody ))return; |
|
| 65 | + if( $phpmailer->ContentType === 'text/plain' || !empty( $phpmailer->AltBody )) { |
|
| 66 | + return; |
|
| 67 | + } |
|
| 66 | 68 | $phpmailer->AltBody = $this->buildPlainTextMessage( $phpmailer->Body ); |
| 67 | 69 | }); |
| 68 | 70 | |
@@ -86,7 +88,9 @@ discard block |
||
| 86 | 88 | */ |
| 87 | 89 | public function send() |
| 88 | 90 | { |
| 89 | - if( !$this->message || !$this->subject || !$this->to )return; |
|
| 91 | + if( !$this->message || !$this->subject || !$this->to ) { |
|
| 92 | + return; |
|
| 93 | + } |
|
| 90 | 94 | |
| 91 | 95 | $sent = wp_mail( |
| 92 | 96 | $this->to, |
@@ -226,7 +230,9 @@ discard block |
||
| 226 | 230 | if( !file_exists( $file )) { |
| 227 | 231 | $file = sprintf( '%s/templates/%s.php', dirname( __DIR__ ), $templatePath ); |
| 228 | 232 | } |
| 229 | - if( !file_exists( $file ))return; |
|
| 233 | + if( !file_exists( $file )) { |
|
| 234 | + return; |
|
| 235 | + } |
|
| 230 | 236 | |
| 231 | 237 | ob_start(); |
| 232 | 238 | include $file; |
@@ -148,7 +148,9 @@ discard block |
||
| 148 | 148 | |
| 149 | 149 | // normalize truthy boolean attributes |
| 150 | 150 | foreach( $filtered as $key => $value ) { |
| 151 | - if( !in_array( $key, self::BOOLEAN_ATTRIBUTES ))continue; |
|
| 151 | + if( !in_array( $key, self::BOOLEAN_ATTRIBUTES )) { |
|
| 152 | + continue; |
|
| 153 | + } |
|
| 152 | 154 | |
| 153 | 155 | if( $value !== false ) { |
| 154 | 156 | $filtered[ $key ] = ''; |
@@ -187,11 +189,15 @@ discard block |
||
| 187 | 189 | |
| 188 | 190 | if( $result ) { |
| 189 | 191 | // only allow data attributes to have an empty value |
| 190 | - if( $wildcard != 'data-' && empty( $value ))continue; |
|
| 192 | + if( $wildcard != 'data-' && empty( $value )) { |
|
| 193 | + continue; |
|
| 194 | + } |
|
| 191 | 195 | |
| 192 | 196 | if( is_array( $value )) { |
| 193 | 197 | |
| 194 | - if( $wildcard != 'data-' )continue; |
|
| 198 | + if( $wildcard != 'data-' ) { |
|
| 199 | + continue; |
|
| 200 | + } |
|
| 195 | 201 | |
| 196 | 202 | $value = json_encode( $value ); |
| 197 | 203 | } |
@@ -78,7 +78,9 @@ 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 )) { |
|
| 82 | + break; |
|
| 83 | + } |
|
| 82 | 84 | } |
| 83 | 85 | } |
| 84 | 86 | |
@@ -161,7 +163,9 @@ discard block |
||
| 161 | 163 | */ |
| 162 | 164 | protected function getRule( $attribute, $rules ) |
| 163 | 165 | { |
| 164 | - if( !array_key_exists( $attribute, $this->rules ))return; |
|
| 166 | + if( !array_key_exists( $attribute, $this->rules )) { |
|
| 167 | + return; |
|
| 168 | + } |
|
| 165 | 169 | |
| 166 | 170 | $rules = (array) $rules; |
| 167 | 171 | |
@@ -188,8 +192,7 @@ discard block |
||
| 188 | 192 | |
| 189 | 193 | if( is_numeric( $value ) && $hasNumeric ) { |
| 190 | 194 | return $value; |
| 191 | - } |
|
| 192 | - elseif( is_array( $value )) { |
|
| 195 | + } elseif( is_array( $value )) { |
|
| 193 | 196 | return count( $value ); |
| 194 | 197 | } |
| 195 | 198 | |
@@ -253,8 +256,7 @@ discard block |
||
| 253 | 256 | // If an object was provided, get its public properties |
| 254 | 257 | if( is_object( $data )) { |
| 255 | 258 | $this->data = get_object_vars( $data ); |
| 256 | - } |
|
| 257 | - else { |
|
| 259 | + } else { |
|
| 258 | 260 | $this->data = $data; |
| 259 | 261 | } |
| 260 | 262 | |
@@ -420,7 +422,9 @@ discard block |
||
| 420 | 422 | ? $strings[ $key ] |
| 421 | 423 | : false; |
| 422 | 424 | |
| 423 | - if( !$message )return; |
|
| 425 | + if( !$message ) { |
|
| 426 | + return; |
|
| 427 | + } |
|
| 424 | 428 | |
| 425 | 429 | $message = str_replace( ':attribute', $attribute, $message ); |
| 426 | 430 | |
@@ -464,7 +468,9 @@ discard block |
||
| 464 | 468 | { |
| 465 | 469 | list( $rule, $parameters ) = $this->parseRule( $rule ); |
| 466 | 470 | |
| 467 | - if( $rule == '' )return; |
|
| 471 | + if( $rule == '' ) { |
|
| 472 | + return; |
|
| 473 | + } |
|
| 468 | 474 | |
| 469 | 475 | $method = "validate{$rule}"; |
| 470 | 476 | |
@@ -72,7 +72,9 @@ discard block |
||
| 72 | 72 | */ |
| 73 | 73 | public function generateDescription( $paragraph = true ) |
| 74 | 74 | { |
| 75 | - if( !isset( $this->args['desc'] ) || !$this->args['desc'] )return; |
|
| 75 | + if( !isset( $this->args['desc'] ) || !$this->args['desc'] ) { |
|
| 76 | + return; |
|
| 77 | + } |
|
| 76 | 78 | |
| 77 | 79 | $tag = ( !!$paragraph || $paragraph == 'p' ) ? 'p' : 'span'; |
| 78 | 80 | |
@@ -86,7 +88,9 @@ discard block |
||
| 86 | 88 | */ |
| 87 | 89 | public function generateLabel() |
| 88 | 90 | { |
| 89 | - if( empty( $this->args['label'] ))return; |
|
| 91 | + if( empty( $this->args['label'] )) { |
|
| 92 | + return; |
|
| 93 | + } |
|
| 90 | 94 | |
| 91 | 95 | $for = !!$this->args['id'] |
| 92 | 96 | ? " for=\"{$this->args['id']}\"" |
@@ -145,7 +149,9 @@ discard block |
||
| 145 | 149 | |
| 146 | 150 | if( $method === 'singleInput' ) { |
| 147 | 151 | |
| 148 | - if( !isset( $this->args['options'] ) || empty( $this->args['options'] ))return; |
|
| 152 | + if( !isset( $this->args['options'] ) || empty( $this->args['options'] )) { |
|
| 153 | + return; |
|
| 154 | + } |
|
| 149 | 155 | |
| 150 | 156 | // hack to make sure unset single checkbox values start at 1 instead of 0 |
| 151 | 157 | if( key( $this->args['options'] ) === 0 ) { |
@@ -188,7 +194,9 @@ discard block |
||
| 188 | 194 | { |
| 189 | 195 | // similar to array_merge except overwrite empty values |
| 190 | 196 | foreach( $defaults as $key => $value ) { |
| 191 | - if( isset( $this->args[ $key ] ) && !empty( $this->args[ $key ] ))continue; |
|
| 197 | + if( isset( $this->args[ $key ] ) && !empty( $this->args[ $key ] )) { |
|
| 198 | + continue; |
|
| 199 | + } |
|
| 192 | 200 | $this->args[ $key ] = $value; |
| 193 | 201 | } |
| 194 | 202 | |
@@ -211,7 +219,9 @@ discard block |
||
| 211 | 219 | { |
| 212 | 220 | $args = $this->multiInputArgs( $type, $optionKey, $number ); |
| 213 | 221 | |
| 214 | - if( !$args )return; |
|
| 222 | + if( !$args ) { |
|
| 223 | + return; |
|
| 224 | + } |
|
| 215 | 225 | |
| 216 | 226 | $attributes = ''; |
| 217 | 227 | |
@@ -262,7 +272,9 @@ discard block |
||
| 262 | 272 | |
| 263 | 273 | $args = wp_parse_args( $args, $defaults ); |
| 264 | 274 | |
| 265 | - if( !isset( $label ) || $args['name'] === '' )return; |
|
| 275 | + if( !isset( $label ) || $args['name'] === '' ) { |
|
| 276 | + return; |
|
| 277 | + } |
|
| 266 | 278 | |
| 267 | 279 | $args['id'] = $this->args['id'] . "-{$number}"; |
| 268 | 280 | $args['name'] = $this->args['name'] . ( $type === 'checkbox' && $this->multi ? '[]' : '' ); |
@@ -275,11 +287,9 @@ discard block |
||
| 275 | 287 | if( in_array( $args['value'], $this->args['value'] )) { |
| 276 | 288 | $this->args['default'] = $args['value']; |
| 277 | 289 | } |
| 278 | - } |
|
| 279 | - else if( $this->args['value'] ) { |
|
| 290 | + } else if( $this->args['value'] ) { |
|
| 280 | 291 | $this->args['default'] = $this->args['value']; |
| 281 | - } |
|
| 282 | - else if( $type == 'radio' && !$this->args['default'] ) { |
|
| 292 | + } else if( $type == 'radio' && !$this->args['default'] ) { |
|
| 283 | 293 | $this->args['default'] = 0; |
| 284 | 294 | } |
| 285 | 295 | |
@@ -332,7 +342,9 @@ discard block |
||
| 332 | 342 | |
| 333 | 343 | $args = $this->multiInputArgs( $type, $optionKey, 1 ); |
| 334 | 344 | |
| 335 | - if( !$args )return; |
|
| 345 | + if( !$args ) { |
|
| 346 | + return; |
|
| 347 | + } |
|
| 336 | 348 | |
| 337 | 349 | $atts = $this->normalize(); |
| 338 | 350 | $atts = wp_parse_args( $args['attributes'], $atts ); |