Passed
Push — master ( a31547...ceec33 )
by Paul
05:15
created
plugin/Application.php 2 patches
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.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 	 */
67 67
 	public function getDefaults()
68 68
 	{
69
-		if( empty( $this->defaults )) {
69
+		if( empty($this->defaults) ) {
70 70
 			$this->defaults = $this->make( DefaultsManager::class )->get();
71 71
 			$this->upgrade();
72 72
 		}
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 	 */
79 79
 	public function hasPermission()
80 80
 	{
81
-		return !$this->isAdmin() || ( $this->isAdmin() && current_user_can( static::CAPABILITY ));
81
+		return !$this->isAdmin() || ($this->isAdmin() && current_user_can( static::CAPABILITY ));
82 82
 	}
83 83
 
84 84
 	/**
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 		$types = apply_filters( 'site-reviews/addon/types', [] );
134 134
 		$this->reviewTypes = wp_parse_args( $types, [
135 135
 			'local' => __( 'Local', 'site-reviews' ),
136
-		]);
136
+		] );
137 137
 	}
138 138
 
139 139
 	/**
@@ -143,15 +143,15 @@  discard block
 block discarded – undo
143 143
 	public function render( $view, array $data = [] )
144 144
 	{
145 145
 		$file = '';
146
-		if( glsr( Helper::class )->startsWith( $view, 'templates/' )) {
146
+		if( glsr( Helper::class )->startsWith( $view, 'templates/' ) ) {
147 147
 			$file = str_replace( 'templates/', 'site-reviews/', $view ).'.php';
148 148
 			$file = get_stylesheet_directory().'/'.$file;
149 149
 		}
150
-		if( !file_exists( $file )) {
150
+		if( !file_exists( $file ) ) {
151 151
 			$file = $this->path( 'views/'.$view.'.php' );
152 152
 		}
153 153
 		$file = apply_filters( 'site-reviews/addon/views/file', $file, $view, $data );
154
-		if( !file_exists( $file )) {
154
+		if( !file_exists( $file ) ) {
155 155
 			glsr_log()->error( 'File not found: '.$file );
156 156
 			return;
157 157
 		}
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 	 */
166 166
 	public function scheduleCronJob()
167 167
 	{
168
-		if( wp_next_scheduled( static::CRON_EVENT ))return;
168
+		if( wp_next_scheduled( static::CRON_EVENT ) )return;
169 169
 		wp_schedule_event( time(), 'twicedaily', static::CRON_EVENT );
170 170
 	}
171 171
 
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
 	 */
175 175
 	public function unscheduleCronJob()
176 176
 	{
177
-		wp_unschedule_event( intval( wp_next_scheduled( static::CRON_EVENT )), static::CRON_EVENT );
177
+		wp_unschedule_event( intval( wp_next_scheduled( static::CRON_EVENT ) ), static::CRON_EVENT );
178 178
 	}
179 179
 
180 180
 	/**
@@ -206,6 +206,6 @@  discard block
 block discarded – undo
206 206
 	 */
207 207
 	public function url( $path = '' )
208 208
 	{
209
-		return esc_url( plugin_dir_url( $this->file ).ltrim( trim( $path ), '/' ));
209
+		return esc_url( plugin_dir_url( $this->file ).ltrim( trim( $path ), '/' ) );
210 210
 	}
211 211
 }
Please login to merge, or discard this patch.
plugin/Shortcodes/Shortcode.php 2 patches
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.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -27,10 +27,10 @@  discard block
 block discarded – undo
27 27
 			'after_widget' => '</div>',
28 28
 			'before_title' => '<h3 class="glsr-shortcode-title">',
29 29
 			'after_title' => '</h3>',
30
-		]);
30
+		] );
31 31
 		$instance = $this->normalize( $instance );
32 32
 		$partial = glsr( Html::class )->buildPartial( $shortcodePartial, $instance );
33
-		if( !empty( $instance['title'] )) {
33
+		if( !empty($instance['title']) ) {
34 34
 			$instance['title'] = $args['before_title'].$instance['title'].$args['after_title'];
35 35
 		}
36 36
 		return $args['before_widget'].$instance['title'].$partial.$args['after_widget'];
@@ -73,10 +73,10 @@  discard block
 block discarded – undo
73 73
 	 */
74 74
 	public function normalize( $args )
75 75
 	{
76
-		$args = shortcode_atts( $this->getDefaults(), wp_parse_args( $args ));
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 ) )return;
80 80
 			$value = $this->$methodName( $value );
81 81
 		});
82 82
 		return $this->sanitize( $args );
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 	 */
109 109
 	protected function normalizeHide( $hide )
110 110
 	{
111
-		if( is_string( $hide )) {
111
+		if( is_string( $hide ) ) {
112 112
 			$hide = explode( ',', $hide );
113 113
 		}
114 114
 		return array_filter( array_map( 'trim', $hide ), function( $value ) {
@@ -139,9 +139,9 @@  discard block
 block discarded – undo
139 139
 			__( 'Terrible', 'site-reviews' ),
140 140
 		];
141 141
 		$defaults = array_pad( $defaults, Rating::MAX_RATING, '' );
142
-		$labels = array_map( 'trim', explode( ',', $labels ));
142
+		$labels = array_map( 'trim', explode( ',', $labels ) );
143 143
 		foreach( $defaults as $i => $label ) {
144
-			if( empty( $labels[$i] ))continue;
144
+			if( empty($labels[$i]) )continue;
145 145
 			$defaults[$i] = $labels[$i];
146 146
 		}
147 147
 		return array_combine( range( Rating::MAX_RATING, 1 ), $defaults );
Please login to merge, or discard this patch.
plugin/Commands/RegisterPostType.php 2 patches
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.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -29,13 +29,13 @@  discard block
 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 ) )continue;
33 33
 			$this->$property = $value;
34
-			unset( $args[$key] );
34
+			unset($args[$key]);
35 35
 		}
36 36
 		$this->args = wp_parse_args( $args, [
37 37
 			'menu_name' => $this->plural,
38
-		]);
38
+		] );
39 39
 	}
40 40
 
41 41
 	/**
@@ -58,8 +58,8 @@  discard block
 block discarded – undo
58 58
 			'singular_name' => $this->single,
59 59
 			'uploaded_to_this_item' => sprintf( _x( 'Uploaded to this %s', 'Uploaded to this Post', 'site-reviews' ), $this->single ),
60 60
 			'view_item' => sprintf( _x( 'View %s', 'View Post', 'site-reviews' ), $this->single ),
61
-		]);
62
-		unset( $this->args['menu_name'] );
61
+		] );
62
+		unset($this->args['menu_name']);
63 63
 	}
64 64
 
65 65
 	/**
@@ -68,12 +68,12 @@  discard block
 block discarded – undo
68 68
 	protected function normalizeColumns()
69 69
 	{
70 70
 		$this->columns = ['cb' => ''] + $this->columns;
71
-		if( array_key_exists( 'category', $this->columns )) {
71
+		if( array_key_exists( 'category', $this->columns ) ) {
72 72
 			$keys = array_keys( $this->columns );
73 73
 			$keys[array_search( 'category', $keys )] = 'taxonomy-'.Application::TAXONOMY;
74 74
 			$this->columns = array_combine( $keys, $this->columns );
75 75
 		}
76
-		if( array_key_exists( 'pinned', $this->columns )) {
76
+		if( array_key_exists( 'pinned', $this->columns ) ) {
77 77
 			$stickyValue = '<span class="pinned-icon"><span>'.$this->columns['pinned'].'</span></span>';
78 78
 			$this->columns['pinned'] = $stickyValue;
79 79
 		}
Please login to merge, or discard this patch.
plugin/Modules/Html/Attributes.php 2 patches
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.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 	 */
113 113
 	protected function filterAttributes( array $allowedAttributeKeys )
114 114
 	{
115
-		return array_intersect_key( $this->attributes, array_flip( $allowedAttributeKeys ));
115
+		return array_intersect_key( $this->attributes, array_flip( $allowedAttributeKeys ) );
116 116
 	}
117 117
 
118 118
 	/**
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
 		$globalAttributes = $this->filterAttributes( static::GLOBAL_ATTRIBUTES );
124 124
 		$wildcards = [];
125 125
 		foreach( static::GLOBAL_WILDCARD_ATTRIBUTES as $wildcard ) {
126
-			$newWildcards = array_filter( $this->attributes, function( $key ) use( $wildcard ) {
126
+			$newWildcards = array_filter( $this->attributes, function( $key ) use($wildcard) {
127 127
 				return glsr( Helper::class )->startsWith( $wildcard, $key );
128 128
 			}, ARRAY_FILTER_USE_KEY );
129 129
 			$wildcards = array_merge( $wildcards, $newWildcards );
@@ -177,11 +177,11 @@  discard block
 block discarded – undo
177 177
 	protected function normalizeBooleanAttributes()
178 178
 	{
179 179
 		foreach( $this->attributes as $key => $value ) {
180
-			if( $this->isAttributeKeyNumeric( $key, $value )) {
180
+			if( $this->isAttributeKeyNumeric( $key, $value ) ) {
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 ) )continue;
185 185
 			$this->attributes[$key] = wp_validate_boolean( $value );
186 186
 		}
187 187
 	}
@@ -192,12 +192,12 @@  discard block
 block discarded – undo
192 192
 	protected function normalizeDataAttributes()
193 193
 	{
194 194
 		foreach( $this->attributes as $key => $value ) {
195
-			if( $this->isAttributeKeyNumeric( $key, $value )) {
195
+			if( $this->isAttributeKeyNumeric( $key, $value ) ) {
196 196
 				$key = $value;
197 197
 				$value = '';
198 198
 			}
199
-			if( !glsr( Helper::class )->startsWith( 'data-', $key ))continue;
200
-			if( is_array( $value )) {
199
+			if( !glsr( Helper::class )->startsWith( 'data-', $key ) )continue;
200
+			if( is_array( $value ) ) {
201 201
 				$value = json_encode( $value, JSON_HEX_APOS | JSON_NUMERIC_CHECK | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES );
202 202
 			}
203 203
 			$this->attributes[$key] = $value;
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
 	protected function normalizeStringAttributes()
211 211
 	{
212 212
 		foreach( $this->attributes as $key => $value ) {
213
-			if( !is_string( $value ))continue;
213
+			if( !is_string( $value ) )continue;
214 214
 			$this->attributes[$key] = trim( $value );
215 215
 		}
216 216
 	}
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
 	{
224 224
 		if( $method != 'input' )return;
225 225
 		$attributes = wp_parse_args( $this->attributes, ['type' => ''] );
226
-		if( !in_array( $attributes['type'], static::INPUT_TYPES )) {
226
+		if( !in_array( $attributes['type'], static::INPUT_TYPES ) ) {
227 227
 			$this->attributes['type'] = 'text';
228 228
 		}
229 229
 	}
@@ -237,11 +237,11 @@  discard block
 block discarded – undo
237 237
 		$dataAttributes = [];
238 238
 		foreach( $this->attributes as $key => $value ) {
239 239
 			if( in_array( $key, static::BOOLEAN_ATTRIBUTES ) && !$value ) {
240
-				unset( $attributes[$key] );
240
+				unset($attributes[$key]);
241 241
 			}
242
-			if( glsr( Helper::class )->startsWith( 'data-', $key )) {
242
+			if( glsr( Helper::class )->startsWith( 'data-', $key ) ) {
243 243
 				$dataAttributes[$key] = $value;
244
-				unset( $attributes[$key] );
244
+				unset($attributes[$key]);
245 245
 			}
246 246
 		}
247 247
 		$this->attributes = array_merge( array_filter( $attributes ), $dataAttributes );
Please login to merge, or discard this patch.
plugin/Modules/Html/Partials/Sections.php 2 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -24,7 +24,9 @@
 block discarded – undo
24 24
 	public function build( $name, array $args = [] )
25 25
 	{
26 26
 		$this->normalize( $args );
27
-		if( count( $this->sections ) < 2 )return;
27
+		if( count( $this->sections ) < 2 ) {
28
+			return;
29
+		}
28 30
 		$links = array_reduce( array_keys( $this->sections ), function( $result, $section ) {
29 31
 			return $result.glsr( Builder::class )->li( $this->buildLink( $section ));
30 32
 		});
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 		$this->normalize( $args );
27 27
 		if( count( $this->sections ) < 2 )return;
28 28
 		$links = array_reduce( array_keys( $this->sections ), function( $result, $section ) {
29
-			return $result.glsr( Builder::class )->li( $this->buildLink( $section ));
29
+			return $result.glsr( Builder::class )->li( $this->buildLink( $section ) );
30 30
 		});
31 31
 		return glsr( Builder::class )->ul( $links, ['class' => 'subsubsub glsr-subsubsub'] );
32 32
 	}
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 			'section' => '',
42 42
 			'tab' => '',
43 43
 			'tabs' => [],
44
-		]);
44
+		] );
45 45
 		$this->sections = $this->args['tabs'][$this->args['tab']]['sections'];
46 46
 	}
47 47
 
@@ -61,6 +61,6 @@  discard block
 block discarded – undo
61 61
 		return glsr( Builder::class )->a( $this->sections[$section], [
62 62
 			'class' => $class,
63 63
 			'href' => '?post_type='.Application::POST_TYPE.'&page='.$this->args['page'].'&tab='.$this->args['tab'].'&section='.$section,
64
-		]).$separator;
64
+		] ).$separator;
65 65
 	}
66 66
 }
Please login to merge, or discard this patch.
plugin/Modules/Html/Partials/SiteReviewsSummary.php 2 patches
Braces   +21 added lines, -7 removed lines patch added patch discarded remove patch
@@ -32,7 +32,9 @@  discard block
 block discarded – undo
32 32
 	{
33 33
 		$this->args = $args;
34 34
 		$this->reviews = glsr( Database::class )->getReviews( $args );
35
-		if( $this->isHidden() )return;
35
+		if( $this->isHidden() ) {
36
+			return;
37
+		}
36 38
 		$this->rating = glsr( Rating::class )->getAverage( $this->reviews->results );
37 39
 		$this->buildSchema();
38 40
 		return glsr( Builder::class )->div( $this->buildSummary().$this->buildPercentageBars(), [
@@ -72,7 +74,9 @@  discard block
 block discarded – undo
72 74
 	 */
73 75
 	protected function buildPercentageBars()
74 76
 	{
75
-		if( in_array( 'bars', $this->args['hide'] ))return;
77
+		if( in_array( 'bars', $this->args['hide'] )) {
78
+			return;
79
+		}
76 80
 		$percentages = preg_filter( '/$/', '%', glsr( Rating::class )->getPercentages( $this->reviews->results ));
77 81
 		$range = range( Rating::MAX_RATING, 1 );
78 82
 		$bars = array_reduce( $range, function( $carry, $index ) use( $percentages ) {
@@ -88,7 +92,9 @@  discard block
 block discarded – undo
88 92
 	 */
89 93
 	protected function buildSchema()
90 94
 	{
91
-		if( !$this->args['schema'] )return;
95
+		if( !$this->args['schema'] ) {
96
+			return;
97
+		}
92 98
 		$schema = glsr( Schema::class );
93 99
 		$schema->store( $schema->buildSummary( $this->args ));
94 100
 	}
@@ -99,7 +105,9 @@  discard block
 block discarded – undo
99 105
 	protected function buildSummary()
100 106
 	{
101 107
 		$summary = $this->buildSummaryRating().$this->buildSummaryStars().$this->buildSummaryText();
102
-		if( empty( $summary ))return;
108
+		if( empty( $summary )) {
109
+			return;
110
+		}
103 111
 		return glsr( Builder::class )->div( $summary, [
104 112
 			'class' => 'glsr-summary',
105 113
 		]);
@@ -110,7 +118,9 @@  discard block
 block discarded – undo
110 118
 	 */
111 119
 	protected function buildSummaryRating()
112 120
 	{
113
-		if( in_array( 'rating', $this->args['hide'] ))return;
121
+		if( in_array( 'rating', $this->args['hide'] )) {
122
+			return;
123
+		}
114 124
 		return glsr( Builder::class )->span( $this->rating, [
115 125
 			'class' => 'glsr-summary-rating',
116 126
 		]);
@@ -121,7 +131,9 @@  discard block
 block discarded – undo
121 131
 	 */
122 132
 	protected function buildSummaryStars()
123 133
 	{
124
-		if( in_array( 'stars', $this->args['hide'] ))return;
134
+		if( in_array( 'stars', $this->args['hide'] )) {
135
+			return;
136
+		}
125 137
 		$stars = glsr( Html::class )->buildPartial( 'star-rating', [
126 138
 			'rating' => $this->rating,
127 139
 		]);
@@ -135,7 +147,9 @@  discard block
 block discarded – undo
135 147
 	 */
136 148
 	protected function buildSummaryText()
137 149
 	{
138
-		if( in_array( 'summary', $this->args['hide'] ))return;
150
+		if( in_array( 'summary', $this->args['hide'] )) {
151
+			return;
152
+		}
139 153
 		$count = count( $this->reviews->results );
140 154
 		if( empty( $this->args['text'] )) {
141 155
 			 $this->args['text'] = _nx(
Please login to merge, or discard this patch.
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 		return glsr( Builder::class )->div( $this->buildSummary().$this->buildPercentageBars(), [
39 39
 			'class' => 'glsr-summary-wrap '.$args['class'],
40 40
 			'id' => $args['id'],
41
-		]);
41
+		] );
42 42
 	}
43 43
 
44 44
 	/**
@@ -51,20 +51,20 @@  discard block
 block discarded – undo
51 51
 		$build = glsr( Builder::class );
52 52
 		$label = $build->span( $this->args['labels'][$index], [
53 53
 			'class' => 'glsr-bar-label',
54
-		]);
55
-		$barBackground = $build->span([
54
+		] );
55
+		$barBackground = $build->span( [
56 56
 			'class' => 'glsr-bar-percent',
57 57
 			'style' => 'width:'.$percent,
58
-		]);
58
+		] );
59 59
 		$barPercent = $build->span( $barBackground, [
60 60
 			'class' => 'glsr-bar-background',
61
-		]);
61
+		] );
62 62
 		$percent = $build->span( $percent, [
63 63
 			'class' => 'glsr-bar-count',
64
-		]);
64
+		] );
65 65
 		return $build->div( $label.$barPercent.$percent, [
66 66
 			'class' => 'glsr-percentage-bar',
67
-		]);
67
+		] );
68 68
 	}
69 69
 
70 70
 	/**
@@ -72,15 +72,15 @@  discard block
 block discarded – undo
72 72
 	 */
73 73
 	protected function buildPercentageBars()
74 74
 	{
75
-		if( in_array( 'bars', $this->args['hide'] ))return;
76
-		$percentages = preg_filter( '/$/', '%', glsr( Rating::class )->getPercentages( $this->reviews->results ));
75
+		if( in_array( 'bars', $this->args['hide'] ) )return;
76
+		$percentages = preg_filter( '/$/', '%', glsr( Rating::class )->getPercentages( $this->reviews->results ) );
77 77
 		$range = range( Rating::MAX_RATING, 1 );
78
-		$bars = array_reduce( $range, function( $carry, $index ) use( $percentages ) {
78
+		$bars = array_reduce( $range, function( $carry, $index ) use($percentages) {
79 79
 			return $carry.$this->buildPercentageBar( intval( $index ), $percentages[$index] );
80 80
 		});
81 81
 		return glsr( Builder::class )->div( $bars, [
82 82
 			'class' => 'glsr-percentage-bars',
83
-		]);
83
+		] );
84 84
 	}
85 85
 
86 86
 	/**
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 	{
91 91
 		if( !$this->args['schema'] )return;
92 92
 		$schema = glsr( Schema::class );
93
-		$schema->store( $schema->buildSummary( $this->args ));
93
+		$schema->store( $schema->buildSummary( $this->args ) );
94 94
 	}
95 95
 
96 96
 	/**
@@ -99,10 +99,10 @@  discard block
 block discarded – undo
99 99
 	protected function buildSummary()
100 100
 	{
101 101
 		$summary = $this->buildSummaryRating().$this->buildSummaryStars().$this->buildSummaryText();
102
-		if( empty( $summary ))return;
102
+		if( empty($summary) )return;
103 103
 		return glsr( Builder::class )->div( $summary, [
104 104
 			'class' => 'glsr-summary',
105
-		]);
105
+		] );
106 106
 	}
107 107
 
108 108
 	/**
@@ -110,10 +110,10 @@  discard block
 block discarded – undo
110 110
 	 */
111 111
 	protected function buildSummaryRating()
112 112
 	{
113
-		if( in_array( 'rating', $this->args['hide'] ))return;
113
+		if( in_array( 'rating', $this->args['hide'] ) )return;
114 114
 		return glsr( Builder::class )->span( $this->rating, [
115 115
 			'class' => 'glsr-summary-rating',
116
-		]);
116
+		] );
117 117
 	}
118 118
 
119 119
 	/**
@@ -121,13 +121,13 @@  discard block
 block discarded – undo
121 121
 	 */
122 122
 	protected function buildSummaryStars()
123 123
 	{
124
-		if( in_array( 'stars', $this->args['hide'] ))return;
124
+		if( in_array( 'stars', $this->args['hide'] ) )return;
125 125
 		$stars = glsr( Html::class )->buildPartial( 'star-rating', [
126 126
 			'rating' => $this->rating,
127
-		]);
127
+		] );
128 128
 		return glsr( Builder::class )->span( $stars, [
129 129
 			'class' => 'glsr-summary-stars',
130
-		]);
130
+		] );
131 131
 	}
132 132
 
133 133
 	/**
@@ -135,9 +135,9 @@  discard block
 block discarded – undo
135 135
 	 */
136 136
 	protected function buildSummaryText()
137 137
 	{
138
-		if( in_array( 'summary', $this->args['hide'] ))return;
138
+		if( in_array( 'summary', $this->args['hide'] ) )return;
139 139
 		$count = count( $this->reviews->results );
140
-		if( empty( $this->args['text'] )) {
140
+		if( empty($this->args['text']) ) {
141 141
 			 $this->args['text'] = _nx(
142 142
 				'{rating} out of {max} stars (based on %d review)',
143 143
 				'{rating} out of {max} stars (based on %d reviews)',
@@ -147,9 +147,9 @@  discard block
 block discarded – undo
147 147
 			);
148 148
 		}
149 149
 		$summary = str_replace(
150
-			['{rating}','{max}'], [$this->rating, Rating::MAX_RATING], $this->args['text']
150
+			['{rating}', '{max}'], [$this->rating, Rating::MAX_RATING], $this->args['text']
151 151
 		);
152
-		return str_replace( ['%s','%d'], $count, $summary );
152
+		return str_replace( ['%s', '%d'], $count, $summary );
153 153
 	}
154 154
 
155 155
 	/**
@@ -157,6 +157,6 @@  discard block
 block discarded – undo
157 157
 	 */
158 158
 	protected function isHidden()
159 159
 	{
160
-		return empty( $this->reviews->results ) && in_array( 'if_empty', $this->args['hide'] );
160
+		return empty($this->reviews->results) && in_array( 'if_empty', $this->args['hide'] );
161 161
 	}
162 162
 }
Please login to merge, or discard this patch.
plugin/Modules/Html/Partials/Tabs.php 2 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -19,7 +19,9 @@
 block discarded – undo
19 19
 	public function build( $name, array $args = [] )
20 20
 	{
21 21
 		$this->normalize( $args );
22
-		if( count( $this->args['tabs'] ) < 2 )return;
22
+		if( count( $this->args['tabs'] ) < 2 ) {
23
+			return;
24
+		}
23 25
 		$links = array_reduce( array_keys( $this->args['tabs'] ), function( $result, $tab ) {
24 26
 			return $result.$this->buildLink( $tab );
25 27
 		});
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 			'page' => '',
36 36
 			'tab' => '',
37 37
 			'tabs' => [],
38
-		]);
38
+		] );
39 39
 	}
40 40
 
41 41
 	/**
@@ -50,6 +50,6 @@  discard block
 block discarded – undo
50 50
 		return glsr( Builder::class )->a( $this->args['tabs'][$tab]['title'], [
51 51
 			'class' => 'nav-tab'.$class,
52 52
 			'href' => '?post_type='.Application::POST_TYPE.'&page='.$this->args['page'].'&tab='.$tab,
53
-		]);
53
+		] );
54 54
 	}
55 55
 }
Please login to merge, or discard this patch.
plugin/Modules/Blacklist.php 2 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -37,7 +37,9 @@
 block discarded – undo
37 37
 		$lines = explode( "\n", $blacklist );
38 38
 		foreach( (array) $lines as $line ) {
39 39
 			$line = trim( $line );
40
-			if( empty( $line ) || 256 < strlen( $line ))continue;
40
+			if( empty( $line ) || 256 < strlen( $line )) {
41
+				continue;
42
+			}
41 43
 			$pattern = sprintf( '#%s#i', preg_quote( $line, '#' ));
42 44
 			if( preg_match( $pattern, $target )) {
43 45
 				return true;
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -12,14 +12,14 @@  discard block
 block discarded – undo
12 12
 	 */
13 13
 	public function isBlacklisted( CreateReview $review )
14 14
 	{
15
-		$target = implode( "\n", array_filter([
15
+		$target = implode( "\n", array_filter( [
16 16
 			$review->author,
17 17
 			$review->content,
18 18
 			$review->email,
19 19
 			$review->ipAddress,
20 20
 			$review->title,
21
-		]));
22
-		return (bool) apply_filters( 'site-reviews/blacklist/is-blacklisted',
21
+		] ) );
22
+		return (bool)apply_filters( 'site-reviews/blacklist/is-blacklisted',
23 23
 			$this->check( $target ),
24 24
 			$review
25 25
 		);
@@ -31,16 +31,16 @@  discard block
 block discarded – undo
31 31
 	 */
32 32
 	protected function check( $target )
33 33
 	{
34
-		$blacklist = trim( glsr( OptionManager::class )->get( 'settings.submissions.blacklist.entries' ));
35
-		if( empty( $blacklist )) {
34
+		$blacklist = trim( glsr( OptionManager::class )->get( 'settings.submissions.blacklist.entries' ) );
35
+		if( empty($blacklist) ) {
36 36
 			return false;
37 37
 		}
38 38
 		$lines = explode( "\n", $blacklist );
39
-		foreach( (array) $lines as $line ) {
39
+		foreach( (array)$lines as $line ) {
40 40
 			$line = trim( $line );
41
-			if( empty( $line ) || 256 < strlen( $line ))continue;
42
-			$pattern = sprintf( '#%s#i', preg_quote( $line, '#' ));
43
-			if( preg_match( $pattern, $target )) {
41
+			if( empty($line) || 256 < strlen( $line ) )continue;
42
+			$pattern = sprintf( '#%s#i', preg_quote( $line, '#' ) );
43
+			if( preg_match( $pattern, $target ) ) {
44 44
 				return true;
45 45
 			}
46 46
 		}
Please login to merge, or discard this patch.
plugin/Modules/Notice.php 2 patches
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -15,7 +15,9 @@  discard block
 block discarded – undo
15 15
 	 */
16 16
 	public function add( $type, $message, array $args = [] )
17 17
 	{
18
-		if( empty( array_filter( [$message, $type] )))return;
18
+		if( empty( array_filter( [$message, $type] ))) {
19
+			return;
20
+		}
19 21
 		$args['message'] = $message;
20 22
 		$args['type'] = $type;
21 23
 		add_settings_error( Application::ID, '', json_encode( $this->normalize( $args )));
@@ -56,7 +58,9 @@  discard block
 block discarded – undo
56 58
 		$notices = array_map( 'unserialize',
57 59
 			array_unique( array_map( 'serialize', get_settings_errors( Application::ID )))
58 60
 		);
59
-		if( empty( $notices ))return;
61
+		if( empty( $notices )) {
62
+			return;
63
+		}
60 64
 		return array_reduce( $notices, function( $carry, $notice ) {
61 65
 			return $carry.$this->buildNotice( json_decode( $notice['message'], true ));
62 66
 		});
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -15,10 +15,10 @@  discard block
 block discarded – undo
15 15
 	 */
16 16
 	public function add( $type, $message, array $args = [] )
17 17
 	{
18
-		if( empty( array_filter( [$message, $type] )))return;
18
+		if( empty(array_filter( [$message, $type] )) )return;
19 19
 		$args['message'] = $message;
20 20
 		$args['type'] = $type;
21
-		add_settings_error( Application::ID, '', json_encode( $this->normalize( $args )));
21
+		add_settings_error( Application::ID, '', json_encode( $this->normalize( $args ) ) );
22 22
 	}
23 23
 
24 24
 	/**
@@ -54,11 +54,11 @@  discard block
 block discarded – undo
54 54
 	public function get()
55 55
 	{
56 56
 		$notices = array_map( 'unserialize',
57
-			array_unique( array_map( 'serialize', get_settings_errors( Application::ID )))
57
+			array_unique( array_map( 'serialize', get_settings_errors( Application::ID ) ) )
58 58
 		);
59
-		if( empty( $notices ))return;
59
+		if( empty($notices) )return;
60 60
 		return array_reduce( $notices, function( $carry, $notice ) {
61
-			return $carry.$this->buildNotice( json_decode( $notice['message'], true ));
61
+			return $carry.$this->buildNotice( json_decode( $notice['message'], true ) );
62 62
 		});
63 63
 	}
64 64
 
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 		}
80 80
 		return glsr( Builder::class )->div( $messages, [
81 81
 			'class' => $class,
82
-		]);
82
+		] );
83 83
 	}
84 84
 
85 85
 	/**
@@ -94,13 +94,13 @@  discard block
 block discarded – undo
94 94
 			'type' => '',
95 95
 		];
96 96
 		$args = shortcode_atts( $defaults, $args );
97
-		if( !in_array( $args['type'], ['error', 'warning', 'success'] )) {
97
+		if( !in_array( $args['type'], ['error', 'warning', 'success'] ) ) {
98 98
 			$args['type'] = 'success';
99 99
 		}
100 100
 		$args['messages'] = is_wp_error( $args['message'] )
101 101
 			? (array)$args['message']->get_error_message()
102 102
 			: (array)$args['message'];
103
-		unset( $args['message'] );
103
+		unset($args['message']);
104 104
 		return $args;
105 105
 	}
106 106
 }
Please login to merge, or discard this patch.