Passed
Push — master ( 6f6d9e...e32a3c )
by Paul
04:05
created
plugin/Database.php 1 patch
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -23,7 +23,9 @@  discard block
 block discarded – undo
23 23
 		while( $reviews = glsr( SqlQueries::class )->getReviewRatings( $greaterThanId )) {
24 24
 			$types = array_keys( array_flip( array_column( $reviews, 'type' )));
25 25
 			foreach( $types as $type ) {
26
-				if( isset( $counts[$type] ))continue;
26
+				if( isset( $counts[$type] )) {
27
+					continue;
28
+				}
27 29
 				$counts[$type] = array_fill_keys( range( 0, Rating::MAX_RATING ), 0 );
28 30
 			}
29 31
 			foreach( $reviews as $review ) {
@@ -60,7 +62,9 @@  discard block
 block discarded – undo
60 62
 		if( empty( $assignedTo )) {
61 63
 			$assignedTo = get_post_meta( $postId, 'assigned_to', true );
62 64
 		}
63
-		if( empty( $assignedTo ))return;
65
+		if( empty( $assignedTo )) {
66
+			return;
67
+		}
64 68
 		$assignedPost = get_post( $assignedTo );
65 69
 		if( $assignedPost instanceof WP_Post && $assignedPost->ID != $postId ) {
66 70
 			return $assignedPost;
@@ -103,7 +107,9 @@  discard block
 block discarded – undo
103 107
 		array_walk( $counts, function( &$ratings ) use( $args ) {
104 108
 			$ratings[0] = 0;
105 109
 			foreach( $ratings as $index => &$num ) {
106
-				if( $index >= intval( $args['min'] ) && $index <= intval( $args['max'] ))continue;
110
+				if( $index >= intval( $args['min'] ) && $index <= intval( $args['max'] )) {
111
+					continue;
112
+				}
107 113
 				$num = 0;
108 114
 			}
109 115
 		});
@@ -173,7 +179,9 @@  discard block
 block discarded – undo
173 179
 		add_filter( 'posts_search', [$queryBuilder, 'filterSearchByTitle'], 500, 2 );
174 180
 		$search = new WP_Query( $args );
175 181
 		remove_filter( 'posts_search', [$queryBuilder, 'filterSearchByTitle'], 500 );
176
-		if( !$search->have_posts() )return;
182
+		if( !$search->have_posts() ) {
183
+			return;
184
+		}
177 185
 		$results = '';
178 186
 		while( $search->have_posts() ) {
179 187
 			$search->the_post();
Please login to merge, or discard this patch.
plugin/Modules/Schema.php 1 patch
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -34,7 +34,9 @@  discard block
 block discarded – undo
34 34
 		foreach( glsr( ReviewManager::class )->get( $this->args )->results as $review ) {
35 35
 			// Only include critic reviews that have been directly produced by your site, not reviews from third- party sites or syndicated reviews.
36 36
 			// @see https://developers.google.com/search/docs/data-types/review
37
-			if( $review->review_type != 'local' )continue;
37
+			if( $review->review_type != 'local' ) {
38
+				continue;
39
+			}
38 40
 			$reviews[] = $this->buildReview( $review );
39 41
 		}
40 42
 		if( !empty( $reviews )) {
@@ -79,7 +81,9 @@  discard block
 block discarded – undo
79 81
 	 */
80 82
 	public function render()
81 83
 	{
82
-		if( is_null( glsr()->schemas ))return;
84
+		if( is_null( glsr()->schemas )) {
85
+			return;
86
+		}
83 87
 		printf( '<script type="application/ld+json">%s</script>', json_encode(
84 88
 			apply_filters( 'site-reviews/schema/all', glsr()->schemas ),
85 89
 			JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES
@@ -131,7 +135,9 @@  discard block
 block discarded – undo
131 135
 	{
132 136
 		foreach( $values as $value ) {
133 137
 			$option = $this->getSchemaOptionValue( $value );
134
-			if( empty( $option ))continue;
138
+			if( empty( $option )) {
139
+				continue;
140
+			}
135 141
 			$schema->$value( $option );
136 142
 		}
137 143
 		return $schema;
@@ -237,7 +243,9 @@  discard block
 block discarded – undo
237 243
 		if( $value != $fallback ) {
238 244
 			return $value;
239 245
 		}
240
-		if( !is_single() && !is_page() )return;
246
+		if( !is_single() && !is_page() ) {
247
+			return;
248
+		}
241 249
 		$method = glsr( Helper::class )->buildMethodName( $option, 'getThing' );
242 250
 		if( method_exists( $this, $method )) {
243 251
 			return $this->$method();
Please login to merge, or discard this patch.
plugin/Modules/Rating.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -92,7 +92,9 @@
 block discarded – undo
92 92
 		$counts = $this->flattenCounts( $reviewCounts );
93 93
 		$total = array_sum( $counts );
94 94
 		foreach( $counts as $index => $count ) {
95
-			if( empty( $count ))continue;
95
+			if( empty( $count )) {
96
+				continue;
97
+			}
96 98
 			$counts[$index] = $count / $total * 100;
97 99
 		}
98 100
 		return $this->getRoundedPercentages( $counts );
Please login to merge, or discard this patch.
plugin/Modules/Upgrader.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,9 @@
 block discarded – undo
17 17
 		natsort( $routines );
18 18
 		array_walk( $routines, function( $routine ) {
19 19
 			$parts = explode( '__', $routine );
20
-			if( version_compare( glsr()->version, end( $parts ), '>=' ))return;
20
+			if( version_compare( glsr()->version, end( $parts ), '>=' )) {
21
+				return;
22
+			}
21 23
 			call_user_func( [$this, $routine] );
22 24
 		});
23 25
 		$this->updateVersion();
Please login to merge, or discard this patch.
plugin/Controllers/EditorController/Metaboxes.php 1 patch
Braces   +30 added lines, -10 removed lines patch added patch discarded remove patch
@@ -23,7 +23,9 @@  discard block
 block discarded – undo
23 23
 	public function onBeforeUpdateReview( WP_Post $review, $metaKey, $metaValue )
24 24
 	{
25 25
 		$previousValue = get_post_meta( $review->ID, $metaKey, true );
26
-		if( $previousValue == $metaValue )return;
26
+		if( $previousValue == $metaValue ) {
27
+			return;
28
+		}
27 29
 		$this->decreaseReviewCount( $review );
28 30
 		$this->increaseReviewCount( $review, [$metaKey => $metaValue] );
29 31
 	}
@@ -36,7 +38,9 @@  discard block
 block discarded – undo
36 38
 	 */
37 39
 	public function onCreateReview( $postData, $meta, $postId )
38 40
 	{
39
-		if( get_post_field( 'post_type', $postId ) !== Application::POST_TYPE )return;
41
+		if( get_post_field( 'post_type', $postId ) !== Application::POST_TYPE ) {
42
+			return;
43
+		}
40 44
 		$review = get_post( $postId );
41 45
 		$this->updateAssignedToPost( $review );
42 46
 		$this->increaseReviewCount( $review );
@@ -48,7 +52,9 @@  discard block
 block discarded – undo
48 52
 	 */
49 53
 	public function onDeleteReview( $postId )
50 54
 	{
51
-		if( get_post_field( 'post_type', $postId ) !== Application::POST_TYPE )return;
55
+		if( get_post_field( 'post_type', $postId ) !== Application::POST_TYPE ) {
56
+			return;
57
+		}
52 58
 		$review = get_post( $postId );
53 59
 		$review->post_status = 'deleted'; // important to change the post_status here first!
54 60
 		$this->updateAssignedToPost( $review );
@@ -85,7 +91,9 @@  discard block
 block discarded – undo
85 91
 	 */
86 92
 	public function saveAssignedToMetabox( $postId )
87 93
 	{
88
-		if( !wp_verify_nonce( glsr( Helper::class )->filterInput( '_nonce-assigned-to' ), 'assigned_to' ))return;
94
+		if( !wp_verify_nonce( glsr( Helper::class )->filterInput( '_nonce-assigned-to' ), 'assigned_to' )) {
95
+			return;
96
+		}
89 97
 		$assignedTo = glsr( Helper::class )->filterInput( 'assigned_to' );
90 98
 		$assignedTo || $assignedTo = '';
91 99
 		if( get_post_meta( $postId, 'assigned_to', true ) != $assignedTo ) {
@@ -100,7 +108,9 @@  discard block
 block discarded – undo
100 108
 	 */
101 109
 	public function saveResponseMetabox( $postId )
102 110
 	{
103
-		if( !wp_verify_nonce( glsr( Helper::class )->filterInput( '_nonce-response' ), 'response' ))return;
111
+		if( !wp_verify_nonce( glsr( Helper::class )->filterInput( '_nonce-response' ), 'response' )) {
112
+			return;
113
+		}
104 114
 		$response = glsr( Helper::class )->filterInput( 'response' );
105 115
 		$response || $response = '';
106 116
 		update_post_meta( $postId, 'response', trim( wp_kses( $response, [
@@ -134,10 +144,14 @@  discard block
 block discarded – undo
134 144
 		]);
135 145
 		if( !in_array( $meta['review_type'], glsr()->reviewTypes )
136 146
 			|| intval( $meta['rating'] ) > Rating::MAX_RATING
137
-		)return;
147
+		) {
148
+			return;
149
+		}
138 150
 		$counts = glsr( OptionManager::class )->get( 'counts.'.$meta['review_type'], [] );
139 151
 		foreach( range( 0, Rating::MAX_RATING ) as $rating ) {
140
-			if( isset( $counts[$rating] ))continue;
152
+			if( isset( $counts[$rating] )) {
153
+				continue;
154
+			}
141 155
 			$counts[$rating] = 0;
142 156
 		}
143 157
 		ksort( $counts );
@@ -150,7 +164,9 @@  discard block
 block discarded – undo
150 164
 	protected function setReviewCounts( WP_Post $review, array $counts )
151 165
 	{
152 166
 		$type = get_post_meta( $review->ID, 'review_type', true );
153
-		if( !in_array( $type, glsr()->reviewTypes ))return;
167
+		if( !in_array( $type, glsr()->reviewTypes )) {
168
+			return;
169
+		}
154 170
 		glsr( OptionManager::class )->set( 'counts.'.$type, $counts );
155 171
 	}
156 172
 
@@ -197,9 +213,13 @@  discard block
 block discarded – undo
197 213
 	 */
198 214
 	protected function updateAssignedToPost( WP_Post $review )
199 215
 	{
200
-		if( !( $postId = $this->getAssignedToPostId( $review->ID )))return;
216
+		if( !( $postId = $this->getAssignedToPostId( $review->ID ))) {
217
+			return;
218
+		}
201 219
 		$reviewIds = array_filter( (array)get_post_meta( $postId, static::META_REVIEW_ID ));
202
-		if( empty( $reviewIds ))return;
220
+		if( empty( $reviewIds )) {
221
+			return;
222
+		}
203 223
 		$this->updateReviewIdOfPost( $postId, $review, $reviewIds );
204 224
 		$updatedReviewIds = array_filter( (array)get_post_meta( $postId, static::META_REVIEW_ID ));
205 225
 		if( empty( $updatedReviewIds )) {
Please login to merge, or discard this patch.