Passed
Branch master (51607c)
by Paul
05:13
created
plugin/Container.php 1 patch
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -70,11 +70,9 @@  discard block
 block discarded – undo
70 70
 	{
71 71
 		if( !property_exists( $this, $property ) || in_array( $property, static::PROTECTED_PROPERTIES )) {
72 72
 			$this->storage[$property] = $value;
73
-		}
74
-		else if( !isset( $this->$property )) {
73
+		} else if( !isset( $this->$property )) {
75 74
 			$this->$property = $value;
76
-		}
77
-		else {
75
+		} else {
78 76
 			throw new Exception( sprintf( 'The "%s" property cannot be changed once set.', $property ));
79 77
 		}
80 78
 	}
@@ -169,8 +167,7 @@  discard block
 block discarded – undo
169 167
 	{
170 168
 		try {
171 169
 			return $this->make( $parameter->getClass()->name );
172
-		}
173
-		catch( Exception $error ) {
170
+		} catch( Exception $error ) {
174 171
 			if( $parameter->isOptional() ) {
175 172
 				return $parameter->getDefaultValue();
176 173
 			}
Please login to merge, or discard this patch.
plugin/Application.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -153,7 +153,9 @@  discard block
 block discarded – undo
153 153
 	 */
154 154
 	public function scheduleCronJob()
155 155
 	{
156
-		if( wp_next_scheduled( static::CRON_EVENT ))return;
156
+		if( wp_next_scheduled( static::CRON_EVENT )) {
157
+			return;
158
+		}
157 159
 		wp_schedule_event( time(), 'twicedaily', static::CRON_EVENT );
158 160
 	}
159 161
 
@@ -184,7 +186,9 @@  discard block
 block discarded – undo
184 186
 			|| !in_array( plugin_basename( $this->file ), $data['plugins'] )
185 187
 			|| $data['action'] != 'update'
186 188
 			|| $data['type'] != 'plugin'
187
-		)return;
189
+		) {
190
+			return;
191
+		}
188 192
 		$this->upgrade();
189 193
 	}
190 194
 
Please login to merge, or discard this patch.
plugin/Shortcodes/Shortcode.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -76,7 +76,9 @@  discard block
 block discarded – undo
76 76
 		$args = shortcode_atts( $this->getDefaults(), wp_parse_args( $args ));
77 77
 		array_walk( $args, function( &$value, $key ) {
78 78
 			$methodName = glsr( Helper::class )->buildMethodName( $key, 'normalize' );
79
-			if( !method_exists( $this, $methodName ))return;
79
+			if( !method_exists( $this, $methodName )) {
80
+				return;
81
+			}
80 82
 			$value = $this->$methodName( $value );
81 83
 		});
82 84
 		return $this->sanitize( $args );
@@ -141,7 +143,9 @@  discard block
 block discarded – undo
141 143
 		$defaults = array_pad( $defaults, Rating::MAX_RATING, '' );
142 144
 		$labels = array_map( 'trim', explode( ',', $labels ));
143 145
 		foreach( $defaults as $i => $label ) {
144
-			if( empty( $labels[$i] ))continue;
146
+			if( empty( $labels[$i] )) {
147
+				continue;
148
+			}
145 149
 			$defaults[$i] = $labels[$i];
146 150
 		}
147 151
 		return array_combine( range( Rating::MAX_RATING, 1 ), $defaults );
Please login to merge, or discard this patch.
plugin/Shortcodes/ButtonGenerator.php 1 patch
Braces   +19 added lines, -8 removed lines patch added patch discarded remove patch
@@ -57,9 +57,13 @@  discard block
 block discarded – undo
57 57
 	protected function generateFields( array $fields )
58 58
 	{
59 59
 		$generatedFields = array_map( function( $field ) {
60
-			if( empty( $field ))return;
60
+			if( empty( $field )) {
61
+				return;
62
+			}
61 63
 			$field = $this->normalize( $field );
62
-			if( !method_exists( $this, $method = 'normalize'.ucfirst( $field['type'] )))return;
64
+			if( !method_exists( $this, $method = 'normalize'.ucfirst( $field['type'] ))) {
65
+				return;
66
+			}
63 67
 			return $this->$method( $field );
64 68
 		}, $fields );
65 69
 		return array_values( array_filter( $generatedFields ));
@@ -74,7 +78,9 @@  discard block
 block discarded – undo
74 78
 		if( !empty( $this->errors )) {
75 79
 			$errors = [];
76 80
 			foreach( $this->required as $name => $alert ) {
77
-				if( false !== array_search( $name, array_column( $fields, 'name' )))continue;
81
+				if( false !== array_search( $name, array_column( $fields, 'name' ))) {
82
+					continue;
83
+				}
78 84
 				$errors[] = $this->errors[$name];
79 85
 			}
80 86
 			$this->errors = $errors;
@@ -118,7 +124,9 @@  discard block
 block discarded – undo
118 124
 	 */
119 125
 	protected function normalizeContainer( array $field )
120 126
 	{
121
-		if( !array_key_exists( 'html', $field ) && !array_key_exists( 'items', $field ))return;
127
+		if( !array_key_exists( 'html', $field ) && !array_key_exists( 'items', $field )) {
128
+			return;
129
+		}
122 130
 		$field['items'] = $this->generateFields( $field['items'] );
123 131
 		return $field;
124 132
 	}
@@ -128,7 +136,9 @@  discard block
 block discarded – undo
128 136
 	 */
129 137
 	protected function normalizeField( array $field, array $defaults )
130 138
 	{
131
-		if( !$this->validate( $field ))return;
139
+		if( !$this->validate( $field )) {
140
+			return;
141
+		}
132 142
 		return array_filter( shortcode_atts( $defaults, $field ), function( $value ) {
133 143
 			return $value !== '';
134 144
 		});
@@ -149,7 +159,9 @@  discard block
 block discarded – undo
149 159
 			'type' => '',
150 160
 			'value' => '',
151 161
 		]);
152
-		if( !$listbox )return;
162
+		if( !$listbox ) {
163
+			return;
164
+		}
153 165
 		if( !array_key_exists( '', $listbox['options'] )) {
154 166
 			$listbox['options'] = ['' => $listbox['placeholder']] + $listbox['options'];
155 167
 		}
@@ -251,8 +263,7 @@  discard block
 block discarded – undo
251 263
 		$alert = esc_html__( 'Some of the shortcode options are required.', 'site-reviews' );
252 264
 		if( isset( $args['required']['alert'] )) {
253 265
 			$alert = $args['required']['alert'];
254
-		}
255
-		else if( !empty( $args['label'] )) {
266
+		} else if( !empty( $args['label'] )) {
256 267
 			$alert = sprintf(
257 268
 				esc_html_x( 'The "%s" option is required.', 'the option label', 'site-reviews' ),
258 269
 				str_replace( ':', '', $args['label'] )
Please login to merge, or discard this patch.
plugin/Commands/RegisterPostType.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -29,7 +29,9 @@
 block discarded – undo
29 29
 	{
30 30
 		foreach( $args as $key => $value ) {
31 31
 			$property = glsr( Helper::class )->buildPropertyName( $key );
32
-			if( !property_exists( $this, $property ))continue;
32
+			if( !property_exists( $this, $property )) {
33
+				continue;
34
+			}
33 35
 			$this->$property = $value;
34 36
 			unset( $args[$key] );
35 37
 		}
Please login to merge, or discard this patch.
plugin/Modules/Validator.php 1 patch
Braces   +13 added lines, -6 removed lines patch added patch discarded remove patch
@@ -74,7 +74,9 @@  discard block
 block discarded – undo
74 74
 		foreach( $this->rules as $attribute => $rules ) {
75 75
 			foreach( $rules as $rule ) {
76 76
 				$this->validateAttribute( $attribute, $rule );
77
-				if( $this->shouldStopValidating( $attribute ))break;
77
+				if( $this->shouldStopValidating( $attribute )) {
78
+					break;
79
+				}
78 80
 			}
79 81
 		}
80 82
 		return $this->errors;
@@ -90,7 +92,9 @@  discard block
 block discarded – undo
90 92
 	public function validateAttribute( $attribute, $rule )
91 93
 	{
92 94
 		list( $rule, $parameters ) = $this->parseRule( $rule );
93
-		if( $rule == '' )return;
95
+		if( $rule == '' ) {
96
+			return;
97
+		}
94 98
 		$value = $this->getValue( $attribute );
95 99
 		$this->validateRequired( $attribute, $value ) || in_array( $rule, $this->implicitRules );
96 100
 		if( !method_exists( $this, $method = 'validate'.$rule )) {
@@ -163,7 +167,9 @@  discard block
 block discarded – undo
163 167
 	 */
164 168
 	protected function getRule( $attribute, $rules )
165 169
 	{
166
-		if( !array_key_exists( $attribute, $this->rules ))return;
170
+		if( !array_key_exists( $attribute, $this->rules )) {
171
+			return;
172
+		}
167 173
 		$rules = (array) $rules;
168 174
 		foreach( $this->rules[$attribute] as $rule ) {
169 175
 			list( $rule, $parameters ) = $this->parseRule( $rule );
@@ -184,8 +190,7 @@  discard block
 block discarded – undo
184 190
 		$hasNumeric = $this->hasRule( $attribute, $this->numericRules );
185 191
 		if( is_numeric( $value ) && $hasNumeric ) {
186 192
 			return $value;
187
-		}
188
-		elseif( is_array( $value )) {
193
+		} elseif( is_array( $value )) {
189 194
 			return count( $value );
190 195
 		}
191 196
 		return mb_strlen( $value );
@@ -314,7 +319,9 @@  discard block
 block discarded – undo
314 319
 		$message = isset( $strings[$key] )
315 320
 			? $strings[$key]
316 321
 			: false;
317
-		if( !$message )return;
322
+		if( !$message ) {
323
+			return;
324
+		}
318 325
 		$message = str_replace( ':attribute', $attribute, $message );
319 326
 		if( method_exists( $this, $replacer = 'replace'.$rule )) {
320 327
 			$message = $this->$replacer( $message, $parameters );
Please login to merge, or discard this patch.
plugin/Modules/Html/Template.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -58,7 +58,9 @@
 block discarded – undo
58 58
 	{
59 59
 		$args = shortcode_atts( array_fill_keys( ['context', 'globals'], [] ), $args );
60 60
 		foreach( $args as $key => $value ) {
61
-			if( is_array( $value ))continue;
61
+			if( is_array( $value )) {
62
+				continue;
63
+			}
62 64
 			$args[$key] = [];
63 65
 		}
64 66
 		return $args;
Please login to merge, or discard this patch.
plugin/Modules/Html/Builder.php 1 patch
Braces   +7 added lines, -4 removed lines patch added patch discarded remove patch
@@ -91,7 +91,9 @@  discard block
 block discarded – undo
91 91
 		];
92 92
 		if( !isset( $properties[$property] )
93 93
 			|| empty( array_filter( [$value], $properties[$property] ))
94
-		)return;
94
+		) {
95
+			return;
96
+		}
95 97
 		$this->$property = $value;
96 98
 	}
97 99
 
@@ -188,7 +190,9 @@  discard block
 block discarded – undo
188 190
 	 */
189 191
 	protected function buildFormLabel()
190 192
 	{
191
-		if( empty( $this->args['label'] ) || $this->args['type'] == 'hidden' )return;
193
+		if( empty( $this->args['label'] ) || $this->args['type'] == 'hidden' ) {
194
+			return;
195
+		}
192 196
 		return $this->label([
193 197
 			'for' => $this->args['id'],
194 198
 			'text' => $this->args['label'],
@@ -247,8 +251,7 @@  discard block
 block discarded – undo
247 251
 		}
248 252
 		if( is_array( $params[0] )) {
249 253
 			$this->args += $params[0];
250
-		}
251
-		else if( is_array( $params[1] )) {
254
+		} else if( is_array( $params[1] )) {
252 255
 			$this->args += $params[1];
253 256
 		}
254 257
 		$this->args = glsr( BuilderDefaults::class )->merge( $this->args );
Please login to merge, or discard this patch.
plugin/Modules/Html/Attributes.php 1 patch
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -181,7 +181,9 @@  discard block
 block discarded – undo
181 181
 				$key = $value;
182 182
 				$value = true;
183 183
 			}
184
-			if( !in_array( $key, static::BOOLEAN_ATTRIBUTES ))continue;
184
+			if( !in_array( $key, static::BOOLEAN_ATTRIBUTES )) {
185
+				continue;
186
+			}
185 187
 			$this->attributes[$key] = wp_validate_boolean( $value );
186 188
 		}
187 189
 	}
@@ -196,7 +198,9 @@  discard block
 block discarded – undo
196 198
 				$key = $value;
197 199
 				$value = '';
198 200
 			}
199
-			if( !glsr( Helper::class )->startsWith( 'data-', $key ))continue;
201
+			if( !glsr( Helper::class )->startsWith( 'data-', $key )) {
202
+				continue;
203
+			}
200 204
 			if( is_array( $value )) {
201 205
 				$value = json_encode( $value, JSON_HEX_APOS | JSON_NUMERIC_CHECK | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES );
202 206
 			}
@@ -210,7 +214,9 @@  discard block
 block discarded – undo
210 214
 	protected function normalizeStringAttributes()
211 215
 	{
212 216
 		foreach( $this->attributes as $key => $value ) {
213
-			if( !is_string( $value ))continue;
217
+			if( !is_string( $value )) {
218
+				continue;
219
+			}
214 220
 			$this->attributes[$key] = trim( $value );
215 221
 		}
216 222
 	}
@@ -221,7 +227,9 @@  discard block
 block discarded – undo
221 227
 	 */
222 228
 	protected function normalizeInputType( $method )
223 229
 	{
224
-		if( $method != 'input' )return;
230
+		if( $method != 'input' ) {
231
+			return;
232
+		}
225 233
 		$attributes = wp_parse_args( $this->attributes, ['type' => ''] );
226 234
 		if( !in_array( $attributes['type'], static::INPUT_TYPES )) {
227 235
 			$this->attributes['type'] = 'text';
Please login to merge, or discard this patch.