Passed
Push — master ( ed8579...f866b8 )
by Paul
05:30
created
plugin/Helper.php 2 patches
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
 	{
17 17
 		$className = $this->camelCase( $name );
18 18
 		$path = ltrim( str_replace( __NAMESPACE__, '', $path ), '\\' );
19
-		return !empty( $path )
19
+		return !empty($path)
20 20
 			? __NAMESPACE__.'\\'.$path.'\\'.$className
21 21
 			: $className;
22 22
 	}
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 	 */
29 29
 	public function buildMethodName( $name, $prefix = '' )
30 30
 	{
31
-		return lcfirst( $prefix.$this->buildClassName( $name ));
31
+		return lcfirst( $prefix.$this->buildClassName( $name ) );
32 32
 	}
33 33
 
34 34
 	/**
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 	 */
38 38
 	public function buildPropertyName( $name )
39 39
 	{
40
-		return lcfirst( $this->buildClassName( $name ));
40
+		return lcfirst( $this->buildClassName( $name ) );
41 41
 	}
42 42
 
43 43
 	/**
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 	 */
47 47
 	public function camelCase( $string )
48 48
 	{
49
-		$string = ucwords( str_replace( ['-', '_'], ' ', trim( $string )));
49
+		$string = ucwords( str_replace( ['-', '_'], ' ', trim( $string ) ) );
50 50
 		return str_replace( ' ', '', $string );
51 51
 	}
52 52
 
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 	 */
79 79
 	public function convertPathToId( $path, $prefix = '' )
80 80
 	{
81
-		return str_replace( ['[', ']'], ['-', ''], $this->convertPathToName( $path, $prefix ));
81
+		return str_replace( ['[', ']'], ['-', ''], $this->convertPathToName( $path, $prefix ) );
82 82
 	}
83 83
 
84 84
 	/**
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 	{
90 90
 		$levels = explode( '.', $path );
91 91
 		return array_reduce( $levels, function( $result, $value ) {
92
-			return $result.= '['.$value.']';
92
+			return $result .= '['.$value.']';
93 93
 		}, $prefix );
94 94
 	}
95 95
 
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 	 */
101 101
 	public function convertStringToArray( $string, $callback = null )
102 102
 	{
103
-		$array = array_map( 'trim', explode( ',', $string ));
103
+		$array = array_map( 'trim', explode( ',', $string ) );
104 104
 		return $callback
105 105
 			? array_filter( $array, $callback )
106 106
 			: array_filter( $array );
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 	 */
113 113
 	public function dashCase( $string )
114 114
 	{
115
-		return str_replace( '_', '-', $this->snakeCase( $string ));
115
+		return str_replace( '_', '-', $this->snakeCase( $string ) );
116 116
 	}
117 117
 
118 118
 	/**
@@ -134,11 +134,11 @@  discard block
 block discarded – undo
134 134
 	 */
135 135
 	public function filterInput( $key, array $request = [] )
136 136
 	{
137
-		if( isset( $request[$key] )) {
137
+		if( isset($request[$key]) ) {
138 138
 			return $request[$key];
139 139
 		}
140 140
 		$variable = filter_input( INPUT_POST, $key );
141
-		if( is_null( $variable ) && isset( $_POST[$key] )) {
141
+		if( is_null( $variable ) && isset($_POST[$key]) ) {
142 142
 			$variable = $_POST[$key];
143 143
 		}
144 144
 		return $variable;
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
 	public function filterInputArray( $key )
152 152
 	{
153 153
 		$variable = filter_input( INPUT_POST, $key, FILTER_DEFAULT, FILTER_REQUIRE_ARRAY );
154
-		if( empty( $variable ) && !empty( $_POST[$key] ) && is_array( $_POST[$key] )) {
154
+		if( empty($variable) && !empty($_POST[$key]) && is_array( $_POST[$key] ) ) {
155 155
 			$variable = $_POST[$key];
156 156
 		}
157 157
 		return (array)$variable;
@@ -167,13 +167,13 @@  discard block
 block discarded – undo
167 167
 		$result = [];
168 168
 		foreach( $array as $key => $value ) {
169 169
 			$newKey = ltrim( $prefix.'.'.$key, '.' );
170
-			if( $this->isIndexedFlatArray( $value )) {
170
+			if( $this->isIndexedFlatArray( $value ) ) {
171 171
 				if( $flattenValue ) {
172 172
 					$value = '['.implode( ', ', $value ).']';
173 173
 				}
174 174
 			}
175
-			else if( is_array( $value )) {
176
-				$result = array_merge( $result, $this->flattenArray( $value, $flattenValue, $newKey ));
175
+			else if( is_array( $value ) ) {
176
+				$result = array_merge( $result, $this->flattenArray( $value, $flattenValue, $newKey ) );
177 177
 				continue;
178 178
 			}
179 179
 			$result[$newKey] = $value;
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
 				Whip::IPV4 => $cloudflareIps['v4'],
193 193
 				Whip::IPV6 => $cloudflareIps['v6'],
194 194
 			],
195
-		]))->getValidIpAddress();
195
+		] ))->getValidIpAddress();
196 196
 	}
197 197
 
198 198
 	/**
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
 	{
206 206
 		$keys = explode( '.', $path );
207 207
 		foreach( $keys as $key ) {
208
-			if( !isset( $values[$key] )) {
208
+			if( !isset($values[$key]) ) {
209 209
 				return $fallback;
210 210
 			}
211 211
 			$values = $values[$key];
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
 	 */
220 220
 	public function isIndexedArray( $array )
221 221
 	{
222
-		if( !is_array( $array )) {
222
+		if( !is_array( $array ) ) {
223 223
 			return false;
224 224
 		}
225 225
 		$current = 0;
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
 	 */
239 239
 	public function isIndexedFlatArray( $array )
240 240
 	{
241
-		if( !is_array( $array ) || array_filter( $array, 'is_array' )) {
241
+		if( !is_array( $array ) || array_filter( $array, 'is_array' ) ) {
242 242
 			return false;
243 243
 		}
244 244
 		return $this->isIndexedArray( $array );
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
 	 */
252 252
 	public function prefixString( $string, $prefix = '' )
253 253
 	{
254
-		return $prefix.str_replace( $prefix, '', trim( $string ));
254
+		return $prefix.str_replace( $prefix, '', trim( $string ) );
255 255
 	}
256 256
 
257 257
 	/**
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
 	 */
277 277
 	public function removePrefix( $prefix, $text ) {
278 278
 		return 0 === strpos( $text, $prefix )
279
-			? substr( $text, strlen( $prefix ))
279
+			? substr( $text, strlen( $prefix ) )
280 280
 			: $text;
281 281
 	}
282 282
 
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
 	 */
308 308
 	public function snakeCase( $string )
309 309
 	{
310
-		if( !ctype_lower( $string )) {
310
+		if( !ctype_lower( $string ) ) {
311 311
 			$string = preg_replace( '/\s+/u', '', $string );
312 312
 			$string = preg_replace( '/(.)(?=[A-Z])/u', '$1_', $string );
313 313
 			$string = mb_strtolower( $string, 'UTF-8' );
@@ -322,6 +322,6 @@  discard block
 block discarded – undo
322 322
 	 */
323 323
 	public function startsWith( $needle, $haystack )
324 324
 	{
325
-		return substr( $haystack, 0, strlen( $needle )) === $needle;
325
+		return substr( $haystack, 0, strlen( $needle ) ) === $needle;
326 326
 	}
327 327
 }
Please login to merge, or discard this patch.
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -261,7 +261,9 @@  discard block
 block discarded – undo
261 261
 	{
262 262
 		$result = [];
263 263
 		foreach( $array as $key => $value ) {
264
-			if( !$value )continue;
264
+			if( !$value ) {
265
+				continue;
266
+			}
265 267
 			$result[$key] = is_array( $value )
266 268
 				? $this->removeEmptyArrayValues( $value )
267 269
 				: $value;
@@ -274,7 +276,8 @@  discard block
 block discarded – undo
274 276
 	 * @param string $text
275 277
 	 * @return string
276 278
 	 */
277
-	public function removePrefix( $prefix, $text ) {
279
+	public function removePrefix( $prefix, $text )
280
+	{
278 281
 		return 0 === strpos( $text, $prefix )
279 282
 			? substr( $text, strlen( $prefix ))
280 283
 			: $text;
Please login to merge, or discard this patch.
plugin/Modules/Style.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -50,12 +50,12 @@  discard block
 block discarded – undo
50 50
 			'templates/form/submit-button',
51 51
 			'templates/reviews-form',
52 52
 		];
53
-		if( !preg_match( '('.implode( '|', $styledViews ).')', $view )) {
53
+		if( !preg_match( '('.implode( '|', $styledViews ).')', $view ) ) {
54 54
 			return $view;
55 55
 		}
56 56
 		$views = $this->generatePossibleViews( $view );
57 57
 		foreach( $views as $possibleView ) {
58
-			if( !file_exists( glsr()->path( $possibleView.'.php' )))continue;
58
+			if( !file_exists( glsr()->path( $possibleView.'.php' ) ) )continue;
59 59
 			return glsr( Helper::class )->removePrefix( 'views/', $possibleView );
60 60
 		}
61 61
 		return $view;
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 	 */
89 89
 	public function modifyField( Builder $instance )
90 90
 	{
91
-		if( !$this->isPublicInstance( $instance ) || empty( array_filter( $this->fields )))return;
91
+		if( !$this->isPublicInstance( $instance ) || empty(array_filter( $this->fields )) )return;
92 92
 		call_user_func_array( [$this, 'customize'], [&$instance] );
93 93
 	}
94 94
 
@@ -105,9 +105,9 @@  discard block
 block discarded – undo
105 105
 	 */
106 106
 	protected function customize( Builder $instance )
107 107
 	{
108
-		$args = wp_parse_args( $instance->args, array_fill_keys( ['class', 'type'], '' ));
108
+		$args = wp_parse_args( $instance->args, array_fill_keys( ['class', 'type'], '' ) );
109 109
 		$key = $instance->tag.'_'.$args['type'];
110
-		$classes = !isset( $this->fields[$key] )
110
+		$classes = !isset($this->fields[$key])
111 111
 			? $this->fields[$instance->tag]
112 112
 			: $this->fields[$key];
113 113
 		$instance->args['class'] = trim( $args['class'].' '.$classes );
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 		$args = wp_parse_args( $instance->args, [
142 142
 			'is_public' => false,
143 143
 			'is_raw' => false,
144
-		]);
144
+		] );
145 145
 		if( is_admin() || !$args['is_public'] || $args['is_raw'] ) {
146 146
 			return false;
147 147
 		}
Please login to merge, or discard this patch.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -55,7 +55,9 @@  discard block
 block discarded – undo
55 55
 		}
56 56
 		$views = $this->generatePossibleViews( $view );
57 57
 		foreach( $views as $possibleView ) {
58
-			if( !file_exists( glsr()->path( $possibleView.'.php' )))continue;
58
+			if( !file_exists( glsr()->path( $possibleView.'.php' ))) {
59
+				continue;
60
+			}
59 61
 			return glsr( Helper::class )->removePrefix( 'views/', $possibleView );
60 62
 		}
61 63
 		return $view;
@@ -88,7 +90,9 @@  discard block
 block discarded – undo
88 90
 	 */
89 91
 	public function modifyField( Builder $instance )
90 92
 	{
91
-		if( !$this->isPublicInstance( $instance ) || empty( array_filter( $this->fields )))return;
93
+		if( !$this->isPublicInstance( $instance ) || empty( array_filter( $this->fields ))) {
94
+			return;
95
+		}
92 96
 		call_user_func_array( [$this, 'customize'], [&$instance] );
93 97
 	}
94 98
 
Please login to merge, or discard this patch.