Passed
Push — master ( ecb0f6...008868 )
by Paul
04:35
created
plugin/Review.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -69,7 +69,9 @@  discard block
 block discarded – undo
69 69
 		$properties = glsr( CreateReviewDefaults::class )->restrict( array_merge( $defaults, $meta ));
70 70
 		$this->modified = $this->isModified( $properties );
71 71
 		array_walk( $properties, function( $value, $key ) {
72
-			if( !property_exists( $this, $key ) || isset( $this->$key ))return;
72
+			if( !property_exists( $this, $key ) || isset( $this->$key )) {
73
+				return;
74
+			}
73 75
 			$this->$key = maybe_unserialize( $value );
74 76
 		});
75 77
 	}
@@ -80,7 +82,9 @@  discard block
 block discarded – undo
80 82
 	protected function setTermIds( WP_Post $post )
81 83
 	{
82 84
 		$this->term_ids = [];
83
-		if( !is_array( $terms = get_the_terms( $post, Application::TAXONOMY )))return;
85
+		if( !is_array( $terms = get_the_terms( $post, Application::TAXONOMY ))) {
86
+			return;
87
+		}
84 88
 		foreach( $terms as $term ) {
85 89
 			$this->term_ids[] = $term->term_id;
86 90
 		}
Please login to merge, or discard this patch.
plugin/Defaults/DefaultsAbstract.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,9 @@
 block discarded – undo
13 13
 	 */
14 14
 	public function __call( $name, array $args = [] )
15 15
 	{
16
-		if( !method_exists( $this, $name ))return;
16
+		if( !method_exists( $this, $name )) {
17
+			return;
18
+		}
17 19
 		$defaults = call_user_func_array( [$this, $name], $args );
18 20
 		$hookName = (new ReflectionClass( $this ))->getShortName();
19 21
 		$hookName = str_replace( 'Defaults', '', $hookName );
Please login to merge, or discard this patch.
plugin/Controllers/EditorController.php 1 patch
Braces   +24 added lines, -8 removed lines patch added patch discarded remove patch
@@ -89,7 +89,9 @@  discard block
 block discarded – undo
89 89
 	 */
90 90
 	public function registerMetaBoxes( $postType )
91 91
 	{
92
-		if( $postType != Application::POST_TYPE )return;
92
+		if( $postType != Application::POST_TYPE ) {
93
+			return;
94
+		}
93 95
 		add_meta_box( Application::ID.'_assigned_to', __( 'Assigned To', 'site-reviews' ), [$this, 'renderAssignedToMetabox'], null, 'side' );
94 96
 		add_meta_box( Application::ID.'_review', __( 'Details', 'site-reviews' ), [$this, 'renderDetailsMetaBox'], null, 'side' );
95 97
 		add_meta_box( Application::ID.'_response', __( 'Respond Publicly', 'site-reviews' ), [$this, 'renderResponseMetaBox'], null, 'normal' );
@@ -119,7 +121,9 @@  discard block
 block discarded – undo
119 121
 	 */
120 122
 	public function renderAssignedToMetabox( WP_Post $post )
121 123
 	{
122
-		if( !$this->isReviewPostType( $post ))return;
124
+		if( !$this->isReviewPostType( $post )) {
125
+			return;
126
+		}
123 127
 		$assignedTo = (string)get_post_meta( $post->ID, 'assigned_to', true );
124 128
 		wp_nonce_field( 'assigned_to', '_nonce-assigned-to', false );
125 129
 		glsr()->render( 'partials/editor/metabox-assigned-to', [
@@ -134,7 +138,9 @@  discard block
 block discarded – undo
134 138
 	 */
135 139
 	public function renderDetailsMetaBox( WP_Post $post )
136 140
 	{
137
-		if( !$this->isReviewPostType( $post ))return;
141
+		if( !$this->isReviewPostType( $post )) {
142
+			return;
143
+		}
138 144
 		$review = glsr( ReviewManager::class )->single( $post );
139 145
 		glsr()->render( 'partials/editor/metabox-details', [
140 146
 			'button' => $this->buildDetailsMetaBoxRevertButton( $review, $post ),
@@ -148,7 +154,9 @@  discard block
 block discarded – undo
148 154
 	 */
149 155
 	public function renderPinnedInPublishMetaBox()
150 156
 	{
151
-		if( !$this->isReviewPostType( get_post() ))return;
157
+		if( !$this->isReviewPostType( get_post() )) {
158
+			return;
159
+		}
152 160
 		glsr( Template::class )->render( 'partials/editor/pinned', [
153 161
 			'context' => [
154 162
 				'no' => __( 'No', 'site-reviews' ),
@@ -164,7 +172,9 @@  discard block
 block discarded – undo
164 172
 	 */
165 173
 	public function renderResponseMetaBox( WP_Post $post )
166 174
 	{
167
-		if( !$this->isReviewPostType( $post ))return;
175
+		if( !$this->isReviewPostType( $post )) {
176
+			return;
177
+		}
168 178
 		wp_nonce_field( 'response', '_nonce-response', false );
169 179
 		glsr()->render( 'partials/editor/metabox-response', [
170 180
 			'response' => get_post_meta( $post->ID, 'response', true ),
@@ -178,7 +188,9 @@  discard block
 block discarded – undo
178 188
 	 */
179 189
 	public function renderTaxonomyMetabox( WP_Post $post )
180 190
 	{
181
-		if( !$this->isReviewPostType( $post ))return;
191
+		if( !$this->isReviewPostType( $post )) {
192
+			return;
193
+		}
182 194
 		glsr()->render( 'partials/editor/metabox-categories', [
183 195
 			'post' => $post,
184 196
 			'tax_name' => Application::TAXONOMY,
@@ -216,7 +228,9 @@  discard block
 block discarded – undo
216 228
 	protected function buildAssignedToTemplate( $assignedTo, WP_Post $post )
217 229
 	{
218 230
 		$assignedPost = glsr( Database::class )->getAssignedToPost( $post->ID, $assignedTo );
219
-		if( !( $assignedPost instanceof WP_Post ))return;
231
+		if( !( $assignedPost instanceof WP_Post )) {
232
+			return;
233
+		}
220 234
 		return glsr( Template::class )->build( 'partials/editor/assigned-post', [
221 235
 			'context' => [
222 236
 				'data.url' => (string)get_permalink( $assignedPost ),
@@ -257,7 +271,9 @@  discard block
 block discarded – undo
257 271
 	 */
258 272
 	protected function getReviewType( $review )
259 273
 	{
260
-		if( count( glsr()->reviewTypes ) < 2 )return;
274
+		if( count( glsr()->reviewTypes ) < 2 ) {
275
+			return;
276
+		}
261 277
 		$reviewType = array_key_exists( $review->review_type, glsr()->reviewTypes )
262 278
 			? glsr()->reviewTypes[$review->review_type]
263 279
 			: __( 'Unknown', 'site-reviews' );
Please login to merge, or discard this patch.
plugin/Controllers/AdminController.php 1 patch
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -109,7 +109,9 @@  discard block
 block discarded – undo
109 109
 	 */
110 110
 	public function renderReviewEditor( WP_Post $post )
111 111
 	{
112
-		if( !$this->isReviewPostType( $post ) || $this->isReviewEditable( $post ))return;
112
+		if( !$this->isReviewPostType( $post ) || $this->isReviewEditable( $post )) {
113
+			return;
114
+		}
113 115
 		glsr()->render( 'partials/editor/review', [
114 116
 			'post' => $post,
115 117
 		]);
@@ -121,7 +123,9 @@  discard block
 block discarded – undo
121 123
 	 */
122 124
 	public function renderReviewNotice( WP_Post $post )
123 125
 	{
124
-		if( !$this->isReviewPostType( $post ) || $this->isReviewEditable( $post ))return;
126
+		if( !$this->isReviewPostType( $post ) || $this->isReviewEditable( $post )) {
127
+			return;
128
+		}
125 129
 		glsr( Notice::class )->addWarning( __( 'This review is read-only.', 'site-reviews' ));
126 130
 		glsr( Template::class )->render( 'partials/editor/notice', [
127 131
 			'context' => [
@@ -136,12 +140,16 @@  discard block
 block discarded – undo
136 140
 	 */
137 141
 	public function renderTinymceButton()
138 142
 	{
139
-		if( glsr_current_screen()->base != 'post' )return;
143
+		if( glsr_current_screen()->base != 'post' ) {
144
+			return;
145
+		}
140 146
 		$shortcodes = [];
141 147
 		foreach( glsr()->mceShortcodes as $shortcode => $values ) {
142 148
 			$shortcodes[$shortcode] = $values;
143 149
 		}
144
-		if( empty( $shortcodes ))return;
150
+		if( empty( $shortcodes )) {
151
+			return;
152
+		}
145 153
 		glsr()->render( 'partials/editor/tinymce', [
146 154
 			'shortcodes' => $shortcodes,
147 155
 		]);
Please login to merge, or discard this patch.
plugin/Controllers/TaxonomyController.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -35,7 +35,9 @@
 block discarded – undo
35 35
 	 */
36 36
 	public function renderTaxonomyFilter()
37 37
 	{
38
-		if( !is_object_in_taxonomy( get_current_screen()->post_type, Application::TAXONOMY ))return;
38
+		if( !is_object_in_taxonomy( get_current_screen()->post_type, Application::TAXONOMY )) {
39
+			return;
40
+		}
39 41
 		echo glsr( Builder::class )->label( __( 'Filter by category', 'site-reviews' ), [
40 42
 			'class' => 'screen-reader-text',
41 43
 			'for' => Application::TAXONOMY,
Please login to merge, or discard this patch.
plugin/Database/ReviewManager.php 1 patch
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -111,7 +111,9 @@  discard block
 block discarded – undo
111 111
 		$termIds = glsr( Helper::class )->convertStringToArray( $commaSeparatedTermIds );
112 112
 		foreach( $termIds as $termId ) {
113 113
 			$term = get_term( $termId, Application::TAXONOMY );
114
-			if( !isset( $term->term_id ))continue;
114
+			if( !isset( $term->term_id )) {
115
+				continue;
116
+			}
115 117
 			$terms[] = $term->term_id;
116 118
 		}
117 119
 		return $terms;
@@ -123,7 +125,9 @@  discard block
 block discarded – undo
123 125
 	 */
124 126
 	public function revert( $postId )
125 127
 	{
126
-		if( get_post_field( 'post_type', $postId ) != Application::POST_TYPE )return;
128
+		if( get_post_field( 'post_type', $postId ) != Application::POST_TYPE ) {
129
+			return;
130
+		}
127 131
 		delete_post_meta( $postId, '_edit_last' );
128 132
 		$result = wp_update_post([
129 133
 			'ID' => $postId,
@@ -141,7 +145,9 @@  discard block
 block discarded – undo
141 145
 	 */
142 146
 	public function single( WP_Post $post )
143 147
 	{
144
-		if( $post->post_type != Application::POST_TYPE )return;
148
+		if( $post->post_type != Application::POST_TYPE ) {
149
+			return;
150
+		}
145 151
 		$review = new Review( $post );
146 152
 		return apply_filters( 'site-reviews/get/review', $review, $post );
147 153
 	}
@@ -166,7 +172,9 @@  discard block
 block discarded – undo
166 172
 	protected function setTerms( $postId, $termIds )
167 173
 	{
168 174
 		$terms = $this->normalizeTerms( $termIds );
169
-		if( empty( $terms ))return;
175
+		if( empty( $terms )) {
176
+			return;
177
+		}
170 178
 		$result = wp_set_object_terms( $postId, $terms, Application::TAXONOMY );
171 179
 		if( is_wp_error( $result )) {
172 180
 			glsr_log()->error( $result->get_error_message() );
Please login to merge, or discard this patch.
plugin/Database/QueryBuilder.php 1 patch
Braces   +21 added lines, -7 removed lines patch added patch discarded remove patch
@@ -17,9 +17,13 @@  discard block
 block discarded – undo
17 17
 	{
18 18
 		$queries = [];
19 19
 		foreach( $keys as $key ) {
20
-			if( !array_key_exists( $key, $values ))continue;
20
+			if( !array_key_exists( $key, $values )) {
21
+				continue;
22
+			}
21 23
 			$methodName = glsr( Helper::class )->buildMethodName( $key, __FUNCTION__ );
22
-			if( !method_exists( $this, $methodName ))continue;
24
+			if( !method_exists( $this, $methodName )) {
25
+				continue;
26
+			}
23 27
 			$query = call_user_func( [$this, $methodName], $values[$key] );
24 28
 			if( is_array( $query )) {
25 29
 				$queries[] = $query;
@@ -36,7 +40,9 @@  discard block
 block discarded – undo
36 40
 		$string = '';
37 41
 		$values = array_filter( $values );
38 42
 		foreach( $conditions as $key => $value ) {
39
-			if( !isset( $values[$key] ))continue;
43
+			if( !isset( $values[$key] )) {
44
+				continue;
45
+			}
40 46
 			$values[$key] = implode( ',', (array)$values[$key] );
41 47
 			$string .= strpos( $value, '%s' ) !== false
42 48
 				? sprintf( $value, strval( $values[$key] ))
@@ -110,7 +116,9 @@  discard block
 block discarded – undo
110 116
 	 */
111 117
 	protected function buildQueryAssignedTo( $value )
112 118
 	{
113
-		if( empty( $value ))return;
119
+		if( empty( $value )) {
120
+			return;
121
+		}
114 122
 		$postIds = glsr( Helper::class )->convertStringToArray( $value, 'is_numeric' );
115 123
 		return [
116 124
 			'compare' => 'IN',
@@ -125,7 +133,9 @@  discard block
 block discarded – undo
125 133
 	 */
126 134
 	protected function buildQueryCategory( $value )
127 135
 	{
128
-		if( empty( $value ))return;
136
+		if( empty( $value )) {
137
+			return;
138
+		}
129 139
 		return [
130 140
 			'field' => 'term_id',
131 141
 			'taxonomy' => Application::TAXONOMY,
@@ -139,7 +149,9 @@  discard block
 block discarded – undo
139 149
 	 */
140 150
 	protected function buildQueryRating( $value )
141 151
 	{
142
-		if( !is_numeric( $value ) || !in_array( intval( $value ), range( 1, 5 )))return;
152
+		if( !is_numeric( $value ) || !in_array( intval( $value ), range( 1, 5 ))) {
153
+			return;
154
+		}
143 155
 		return [
144 156
 			'compare' => '>=',
145 157
 			'key' => 'rating',
@@ -153,7 +165,9 @@  discard block
 block discarded – undo
153 165
 	 */
154 166
 	protected function buildQueryType( $value )
155 167
 	{
156
-		if( in_array( $value, ['','all'] ))return;
168
+		if( in_array( $value, ['','all'] )) {
169
+			return;
170
+		}
157 171
 		return [
158 172
 			'key' => 'review_type',
159 173
 			'value' => $value,
Please login to merge, or discard this patch.
plugin/Database/CountsManager.php 1 patch
Braces   +21 added lines, -7 removed lines patch added patch discarded remove patch
@@ -74,7 +74,9 @@  discard block
 block discarded – undo
74 74
 	 */
75 75
 	public function decreasePostCounts( Review $review )
76 76
 	{
77
-		if( empty( $counts = $this->getPostCounts( $review->assigned_to )))return;
77
+		if( empty( $counts = $this->getPostCounts( $review->assigned_to ))) {
78
+			return;
79
+		}
78 80
 		$counts = $this->decreaseRating( $counts, $review->review_type, $review->rating );
79 81
 		$this->setPostCounts( $review->assigned_to, $counts );
80 82
 	}
@@ -85,7 +87,9 @@  discard block
 block discarded – undo
85 87
 	public function decreaseTermCounts( Review $review )
86 88
 	{
87 89
 		foreach( $review->term_ids as $termId ) {
88
-			if( empty( $counts = $this->getTermCounts( $termId )))continue;
90
+			if( empty( $counts = $this->getTermCounts( $termId ))) {
91
+				continue;
92
+			}
89 93
 			$counts = $this->decreaseRating( $counts, $review->review_type, $review->rating );
90 94
 			$this->setTermCounts( $termId, $counts );
91 95
 		}
@@ -107,7 +111,9 @@  discard block
 block discarded – undo
107 111
 			'min' => Rating::MIN_RATING,
108 112
 		]);
109 113
 		foreach( $counts as $index => &$num ) {
110
-			if( $index >= intval( $args['min'] ) && $index <= intval( $args['max'] ))continue;
114
+			if( $index >= intval( $args['min'] ) && $index <= intval( $args['max'] )) {
115
+				continue;
116
+			}
111 117
 			$num = 0;
112 118
 		}
113 119
 		return $counts;
@@ -192,7 +198,9 @@  discard block
 block discarded – undo
192 198
 	 */
193 199
 	public function increasePostCounts( Review $review )
194 200
 	{
195
-		if( !( get_post( $review->assigned_to ) instanceof WP_Post ))return;
201
+		if( !( get_post( $review->assigned_to ) instanceof WP_Post )) {
202
+			return;
203
+		}
196 204
 		$counts = $this->getPostCounts( $review->assigned_to );
197 205
 		$counts = empty( $counts )
198 206
 			? $this->buildPostCounts( $review->assigned_to )
@@ -241,7 +249,9 @@  discard block
 block discarded – undo
241 249
 	 */
242 250
 	public function setTermCounts( $termId, array $reviewCounts )
243 251
 	{
244
-		if( !term_exists( $termId ))return;
252
+		if( !term_exists( $termId )) {
253
+			return;
254
+		}
245 255
 		$ratingCounts = glsr( CountsManager::class )->flatten( $reviewCounts );
246 256
 		update_term_meta( $termId, static::META_COUNT, $reviewCounts );
247 257
 		update_term_meta( $termId, static::META_AVERAGE, glsr( Rating::class )->getAverage( $ratingCounts ));
@@ -259,7 +269,9 @@  discard block
 block discarded – undo
259 269
 		while( $reviews = $this->queryReviews( $args, $lastPostId, $limit )) {
260 270
 			$types = array_keys( array_flip( array_column( $reviews, 'type' )));
261 271
 			foreach( $types as $type ) {
262
-				if( isset( $counts[$type] ))continue;
272
+				if( isset( $counts[$type] )) {
273
+					continue;
274
+				}
263 275
 				$counts[$type] = array_fill_keys( range( 0, Rating::MAX_RATING ), 0 );
264 276
 			}
265 277
 			foreach( $reviews as $review ) {
@@ -311,7 +323,9 @@  discard block
 block discarded – undo
311 323
 		}
312 324
 		foreach( $reviewCounts as &$counts ) {
313 325
 			foreach( range( 0, Rating::MAX_RATING ) as $index ) {
314
-				if( isset( $counts[$index] ))continue;
326
+				if( isset( $counts[$index] )) {
327
+					continue;
328
+				}
315 329
 				$counts[$index] = 0;
316 330
 			}
317 331
 			ksort( $counts );
Please login to merge, or discard this patch.
plugin/Modules/Style.php 1 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 $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.