Passed
Push — master ( ceec33...d1be46 )
by Paul
05:18
created
plugin/Modules/Html/Template.php 2 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -63,7 +63,9 @@
 block discarded – undo
63 63
 	{
64 64
 		$data = wp_parse_args( $data, array_fill_keys( ['context', 'globals'], [] ));
65 65
 		foreach( $data as $key => $value ) {
66
-			if( is_array( $value ))continue;
66
+			if( is_array( $value )) {
67
+				continue;
68
+			}
67 69
 			$data[$key] = [];
68 70
 		}
69 71
 		$data['template'] = $this;
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -50,9 +50,9 @@
 block discarded – undo
50 50
 	 */
51 51
 	protected function normalize( array $data )
52 52
 	{
53
-		$data = wp_parse_args( $data, array_fill_keys( ['context', 'globals'], [] ));
53
+		$data = wp_parse_args( $data, array_fill_keys( ['context', 'globals'], [] ) );
54 54
 		foreach( $data as $key => $value ) {
55
-			if( is_array( $value ))continue;
55
+			if( is_array( $value ) )continue;
56 56
 			$data[$key] = [];
57 57
 		}
58 58
 		$data['template'] = $this;
Please login to merge, or discard this patch.
plugin/Controllers/SettingsController.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -21,11 +21,11 @@  discard block
 block discarded – undo
21 21
 			return $input;
22 22
 		}
23 23
 		$triggered = true;
24
-		if( !is_array( $input )) {
24
+		if( !is_array( $input ) ) {
25 25
 			$input = ['settings' => []];
26 26
 		}
27 27
 		if( key( $input ) == 'settings' ) {
28
-			glsr( Notice::class )->addSuccess( __( 'Settings updated.', 'site-reviews' ));
28
+			glsr( Notice::class )->addSuccess( __( 'Settings updated.', 'site-reviews' ) );
29 29
 		}
30 30
 		$options = array_replace_recursive( glsr( OptionManager::class )->all(), $input );
31 31
 		$options = $this->sanitizeSubmissions( $input, $options );
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 	{
42 42
 		register_setting( Application::ID.'-settings', OptionManager::databaseKey(), [
43 43
 			'sanitize_callback' => [$this, 'callbackRegisterSettings'],
44
-		]);
44
+		] );
45 45
 	}
46 46
 
47 47
 	/**
@@ -49,9 +49,9 @@  discard block
 block discarded – undo
49 49
 	 */
50 50
 	protected function sanitizeSubmissions( array $input, array $options )
51 51
 	{
52
-		if( isset( $input['settings']['submissions'] )) {
52
+		if( isset($input['settings']['submissions']) ) {
53 53
 			$inputForm = $input['settings']['submissions'];
54
-			$options['settings']['submissions']['required'] = isset( $inputForm['required'] )
54
+			$options['settings']['submissions']['required'] = isset($inputForm['required'])
55 55
 				? $inputForm['required']
56 56
 				: [];
57 57
 		}
@@ -63,13 +63,13 @@  discard block
 block discarded – undo
63 63
 	 */
64 64
 	protected function sanitizeTranslations( array $input, array $options )
65 65
 	{
66
-		if( isset( $input['settings']['translations'] )) {
67
-			$options['settings']['translations'] = array_values( array_filter( $input['settings']['translations'] ));
66
+		if( isset($input['settings']['translations']) ) {
67
+			$options['settings']['translations'] = array_values( array_filter( $input['settings']['translations'] ) );
68 68
 			array_walk( $options['settings']['translations'], function( &$string ) {
69
-				if( isset( $string['s2'] )) {
69
+				if( isset($string['s2']) ) {
70 70
 					$string['s2'] = wp_strip_all_tags( $string['s2'] );
71 71
 				}
72
-				if( isset( $string['p2'] )) {
72
+				if( isset($string['p2']) ) {
73 73
 					$string['p2'] = wp_strip_all_tags( $string['p2'] );
74 74
 				}
75 75
 			});
Please login to merge, or discard this patch.
plugin/Database/Cache.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@
 block discarded – undo
10 10
 	const EXPIRY_TIME = WEEK_IN_SECONDS;
11 11
 
12 12
 	/**
13
- 	 * @return array
13
+	 * @return array
14 14
 	 */
15 15
 	public function getCloudflareIps()
16 16
 	{
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -19,11 +19,11 @@  discard block
 block discarded – undo
19 19
 			$ipAddresses = array_fill_keys( ['v4', 'v6'], [] );
20 20
 			foreach( array_keys( $ipAddresses ) as $version ) {
21 21
 				$response = wp_remote_get( 'https://www.cloudflare.com/ips-'.$version );
22
-				if( is_wp_error( $response )) {
22
+				if( is_wp_error( $response ) ) {
23 23
 					glsr_log()->error( $response->get_error_message() );
24 24
 					continue;
25 25
 				}
26
-				$ipAddresses[$version] = array_filter( explode( PHP_EOL, wp_remote_retrieve_body( $response )));
26
+				$ipAddresses[$version] = array_filter( explode( PHP_EOL, wp_remote_retrieve_body( $response ) ) );
27 27
 			}
28 28
 			set_transient( Application::ID.'_cloudflare_ips', $ipAddresses, static::EXPIRY_TIME );
29 29
 		}
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 		if( $test === false ) {
58 58
 			$response = wp_remote_post( 'https://api.wordpress.org/stats/php/1.0/' );
59 59
 			$test = !is_wp_error( $response )
60
-				&& in_array( $response['response']['code'], range( 200, 299 ))
60
+				&& in_array( $response['response']['code'], range( 200, 299 ) )
61 61
 				? 'Works'
62 62
 				: 'Does not work';
63 63
 			set_transient( Application::ID.'_remote_post_test', $test, static::EXPIRY_TIME );
Please login to merge, or discard this patch.
plugin/Widgets/Widget.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -15,13 +15,13 @@  discard block
 block discarded – undo
15 15
 	public function __construct( $idBase, $name, $values )
16 16
 	{
17 17
 		$controlOptions = $widgetOptions = [];
18
-		if( isset( $values['class'] )) {
18
+		if( isset($values['class']) ) {
19 19
 			$widgetOptions['classname'] = $values['class'];
20 20
 		}
21
-		if( isset( $values['description'] )) {
21
+		if( isset($values['description']) ) {
22 22
 			$widgetOptions['description'] = $values['description'];
23 23
 		}
24
-		if( isset( $values['width'] )) {
24
+		if( isset($values['width']) ) {
25 25
 			$controlOptions['width'] = $values['width'];
26 26
 		}
27 27
 		parent::__construct( $idBase, $name, $widgetOptions, $controlOptions );
@@ -34,10 +34,10 @@  discard block
 block discarded – undo
34 34
 	protected function renderField( $tag, array $args = [] )
35 35
 	{
36 36
 		$args = $this->normalizeFieldAttributes( $tag, $args );
37
-		$field = glsr( Html::class )->build( ['is_widget' => true] )->{$tag}( $args['name'], $args );
37
+		$field = glsr( Html::class )->build( ['is_widget' => true] )->{$tag}($args['name'], $args);
38 38
 		echo glsr( Html::class )->build( ['is_widget' => true] )->div( $field, [
39 39
 			'class' => 'glsr-field',
40
-		]);
40
+		] );
41 41
 	}
42 42
 
43 43
 	/**
@@ -46,10 +46,10 @@  discard block
 block discarded – undo
46 46
 	 */
47 47
 	protected function normalizeFieldAttributes( $tag, array $args )
48 48
 	{
49
-		if( empty( $args['value'] )) {
49
+		if( empty($args['value']) ) {
50 50
 			$args['value'] = $this->widgetArgs[$args['name']];
51 51
 		}
52
-		if( empty( $this->widgetArgs['options'] ) && in_array( $tag, ['checkbox', 'radio'] )) {
52
+		if( empty($this->widgetArgs['options']) && in_array( $tag, ['checkbox', 'radio'] ) ) {
53 53
 			$args['checked'] = in_array( $args['value'], (array)$this->widgetArgs[$args['name']] );
54 54
 		}
55 55
 		$args['id'] = $this->get_field_id( $args['name'] );
Please login to merge, or discard this patch.
plugin/Modules/Html/Builder.php 2 patches
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -87,7 +87,9 @@  discard block
 block discarded – undo
87 87
 		];
88 88
 		if( !isset( $properties[$property] )
89 89
 			|| empty( array_filter( [$value], $properties[$property] ))
90
-		)return;
90
+		) {
91
+			return;
92
+		}
91 93
 		$this->$property = $value;
92 94
 	}
93 95
 
@@ -137,7 +139,9 @@  discard block
 block discarded – undo
137 139
 	 */
138 140
 	protected function buildFieldDescription()
139 141
 	{
140
-		if( empty( $this->args['description'] ))return;
142
+		if( empty( $this->args['description'] )) {
143
+			return;
144
+		}
141 145
 		if( !empty( $this->globals['is_widget'] )) {
142 146
 			return $this->small( $this->args['description'] );
143 147
 		}
@@ -186,7 +190,9 @@  discard block
 block discarded – undo
186 190
 	 */
187 191
 	protected function buildFormLabel()
188 192
 	{
189
-		if( empty( $this->args['label'] ) || $this->args['type'] == 'hidden' )return;
193
+		if( empty( $this->args['label'] ) || $this->args['type'] == 'hidden' ) {
194
+			return;
195
+		}
190 196
 		return $this->label([
191 197
 			'for' => $this->args['id'],
192 198
 			'text' => $this->args['label'],
Please login to merge, or discard this patch.
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -59,9 +59,9 @@  discard block
 block discarded – undo
59 59
 	 */
60 60
 	public function __call( $method, $args )
61 61
 	{
62
-		$instance = new static( $this->globals );
62
+		$instance = new static($this->globals);
63 63
 		$instance->setTagFromMethod( $method );
64
-		call_user_func_array( [$instance, 'normalize'], $args += ['',''] );
64
+		call_user_func_array( [$instance, 'normalize'], $args += ['', ''] );
65 65
 		$tags = array_merge( static::TAGS_FORM, static::TAGS_STRUCTURE, static::TAGS_TEXT );
66 66
 		$generatedTag = in_array( $instance->tag, $tags )
67 67
 			? $instance->buildTag()
@@ -85,8 +85,8 @@  discard block
 block discarded – undo
85 85
 			'render' => 'is_bool',
86 86
 			'tag' => 'is_string',
87 87
 		];
88
-		if( !isset( $properties[$property] )
89
-			|| empty( array_filter( [$value], $properties[$property] ))
88
+		if( !isset($properties[$property])
89
+			|| empty(array_filter( [$value], $properties[$property] ))
90 90
 		)return;
91 91
 		$this->$property = $value;
92 92
 	}
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 	 */
105 105
 	public function getOpeningTag()
106 106
 	{
107
-		$attributes = glsr( Attributes::class )->{$this->tag}( $this->args )->toString();
107
+		$attributes = glsr( Attributes::class )->{$this->tag}($this->args)->toString();
108 108
 		return '<'.trim( $this->tag.' '.$attributes ).'>';
109 109
 	}
110 110
 
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 	protected function buildCustomField()
115 115
 	{
116 116
 		$className = glsr( Helper::class )->buildClassName( $this->tag, __NAMESPACE__.'\Fields' );
117
-		if( !class_exists( $className )) {
117
+		if( !class_exists( $className ) ) {
118 118
 			glsr_log()->error( 'Field missing: '.$className );
119 119
 			return;
120 120
 		}
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 	 */
127 127
 	protected function buildDefaultTag( $text = '' )
128 128
 	{
129
-		if( empty( $text )) {
129
+		if( empty($text) ) {
130 130
 			$text = $this->args['text'];
131 131
 		}
132 132
 		return $this->getOpeningTag().$text.$this->getClosingTag();
@@ -137,8 +137,8 @@  discard block
 block discarded – undo
137 137
 	 */
138 138
 	protected function buildFieldDescription()
139 139
 	{
140
-		if( empty( $this->args['description'] ))return;
141
-		if( !empty( $this->globals['is_widget'] )) {
140
+		if( empty($this->args['description']) )return;
141
+		if( !empty($this->globals['is_widget']) ) {
142 142
 			return $this->small( $this->args['description'] );
143 143
 		}
144 144
 		return $this->p( $this->args['description'], ['class' => 'description'] );
@@ -149,10 +149,10 @@  discard block
 block discarded – undo
149 149
 	 */
150 150
 	protected function buildFormInput()
151 151
 	{
152
-		if( !in_array( $this->args['type'], ['checkbox', 'radio'] )) {
152
+		if( !in_array( $this->args['type'], ['checkbox', 'radio'] ) ) {
153 153
 			return $this->buildFormLabel().$this->getOpeningTag();
154 154
 		}
155
-		return empty( $this->args['options'] )
155
+		return empty($this->args['options'])
156 156
 			? $this->buildFormInputChoice()
157 157
 			: $this->buildFormInputMultiChoice();
158 158
 	}
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
 	protected function buildFormInputMultiChoice()
172 172
 	{
173 173
 		if( $this->args['type'] == 'checkbox' ) {
174
-			$this->args['name'].= '[]';
174
+			$this->args['name'] .= '[]';
175 175
 		}
176 176
 		// glsr_log( $this->args );
177 177
 		$options = array_reduce( array_keys( $this->args['options'] ), function( $carry, $key ) {
@@ -180,12 +180,12 @@  discard block
 block discarded – undo
180 180
 				'name' => $this->args['name'],
181 181
 				'text' => $this->args['options'][$key],
182 182
 				'value' => $key,
183
-			]));
183
+			]) );
184 184
 		});
185 185
 		return $this->ul( $options, [
186 186
 			'class' => $this->args['class'],
187 187
 			'id' => $this->args['id'],
188
-		]);
188
+		] );
189 189
 	}
190 190
 
191 191
 	/**
@@ -193,11 +193,11 @@  discard block
 block discarded – undo
193 193
 	 */
194 194
 	protected function buildFormLabel()
195 195
 	{
196
-		if( empty( $this->args['label'] ) || $this->args['type'] == 'hidden' )return;
197
-		return $this->label([
196
+		if( empty($this->args['label']) || $this->args['type'] == 'hidden' )return;
197
+		return $this->label( [
198 198
 			'for' => $this->args['id'],
199 199
 			'text' => $this->args['label'],
200
-		]);
200
+		] );
201 201
 	}
202 202
 
203 203
 	/**
@@ -214,11 +214,11 @@  discard block
 block discarded – undo
214 214
 	protected function buildFormSelectOptions()
215 215
 	{
216 216
 		return array_reduce( array_keys( $this->args['options'] ), function( $carry, $key ) {
217
-			return $carry.$this->option([
217
+			return $carry.$this->option( [
218 218
 				'selected' => $this->args['value'] == $key,
219 219
 				'text' => $this->args['options'][$key],
220 220
 				'value' => $key,
221
-			]);
221
+			] );
222 222
 		});
223 223
 	}
224 224
 
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
 	 */
236 236
 	protected function buildTag()
237 237
 	{
238
-		if( !in_array( $this->tag, static::TAGS_FORM )) {
238
+		if( !in_array( $this->tag, static::TAGS_FORM ) ) {
239 239
 			return $this->buildDefaultTag();
240 240
 		}
241 241
 		return call_user_func( [$this, 'buildForm'.ucfirst( $this->tag )] ).$this->buildFieldDescription();
@@ -247,13 +247,13 @@  discard block
 block discarded – undo
247 247
 	 */
248 248
 	protected function normalize( ...$params )
249 249
 	{
250
-		if( is_string( $params[0] ) || is_numeric( $params[0] )) {
250
+		if( is_string( $params[0] ) || is_numeric( $params[0] ) ) {
251 251
 			$this->setNameOrTextAttributeForTag( $params[0] );
252 252
 		}
253
-		if( is_array( $params[0] )) {
253
+		if( is_array( $params[0] ) ) {
254 254
 			$this->args += $params[0];
255 255
 		}
256
-		else if( is_array( $params[1] )) {
256
+		else if( is_array( $params[1] ) ) {
257 257
 			$this->args += $params[1];
258 258
 		}
259 259
 		$this->args = glsr( BuilderDefaults::class )->merge( $this->args );
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
 	protected function setTagFromMethod( $method )
279 279
 	{
280 280
 		$this->tag = strtolower( $method );
281
-		if( in_array( $this->tag, static::INPUT_TYPES )) {
281
+		if( in_array( $this->tag, static::INPUT_TYPES ) ) {
282 282
 			$this->args['type'] = $this->tag;
283 283
 			$this->tag = 'input';
284 284
 		}
Please login to merge, or discard this patch.
plugin/Modules/Html/Fields/Honeypot.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
13 13
 	{
14 14
 		$defaults = wp_parse_args( $this->defaults(), [
15 15
 			'name' => $this->builder->args['text'],
16
-		]);
16
+		] );
17 17
 		$this->builder->args = wp_parse_args( $this->builder->args, $defaults );
18 18
 		$this->builder->tag = 'input';
19 19
 		return $this->builder->getOpeningTag();
Please login to merge, or discard this patch.
plugin/Modules/Html/Form.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -15,17 +15,17 @@  discard block
 block discarded – undo
15 15
 	 */
16 16
 	public function renderFields( $id )
17 17
 	{
18
-		$fields = $this->getSettingFields( $this->normalizeSettingPath( $id ));
18
+		$fields = $this->getSettingFields( $this->normalizeSettingPath( $id ) );
19 19
 		$rows = '';
20 20
 		foreach( $fields as $name => $field ) {
21 21
 			$field = wp_parse_args( $field, ['name' => $name] );
22
-			$rows.= (new Field( $field ))->build();
22
+			$rows .= (new Field( $field ))->build();
23 23
 		}
24 24
 		glsr( Template::class )->render( 'pages/settings/'.$id, [
25 25
 			'context' => [
26 26
 				'rows' => $rows,
27 27
 			],
28
-		]);
28
+		] );
29 29
 	}
30 30
 
31 31
 	/**
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 	protected function getSettingFields( $path )
35 35
 	{
36 36
 		$settings = glsr( DefaultsManager::class )->settings();
37
-		return array_filter( $settings, function( $key ) use( $path ) {
37
+		return array_filter( $settings, function( $key ) use($path) {
38 38
 			return glsr( Helper::class )->startsWith( $path, $key );
39 39
 		}, ARRAY_FILTER_USE_KEY );
40 40
 	}
Please login to merge, or discard this patch.
views/pages/addons/index.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
 				'name' => 'tripadvisor',
13 13
 				'title' => 'Tripadvisor Reviews',
14 14
 			],
15
-		]);
15
+		] );
16 16
 		$template->render( 'partials/addons/addon', [
17 17
 			'context' => [
18 18
 				'description' => __( 'Sync your Yelp reviews and display them on your site.', 'site-reviews' ),
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 				'name' => 'yelp',
21 21
 				'title' => 'Yelp Reviews',
22 22
 			],
23
-		]);
23
+		] );
24 24
 	?>
25 25
 	</div>
26 26
 </div>
Please login to merge, or discard this patch.
views/partials/translations/plural.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@
 block discarded – undo
3 3
 		<p>{{ data.s1 }}</p>
4 4
 		<p>{{ data.p1 }}</p>
5 5
 		<p class="row-actions">
6
-			<span class="delete"><a href="#{{ data.index }}" class="delete" aria-label="<?= __( 'Delete translation string', 'site-reviews' );?>"><?= __( 'Delete', 'site-reviews' ); ?></a></span>
6
+			<span class="delete"><a href="#{{ data.index }}" class="delete" aria-label="<?= __( 'Delete translation string', 'site-reviews' ); ?>"><?= __( 'Delete', 'site-reviews' ); ?></a></span>
7 7
 		</p>
8 8
 		<button type="button" class="toggle-row">
9 9
 			<span class="screen-reader-text"><?= __( 'Show custom translation', 'site-reviews' ); ?></span>
Please login to merge, or discard this patch.