Passed
Push — master ( 60ab10...dc3967 )
by Paul
05:02
created
plugin/Modules/Email.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -64,7 +64,9 @@  discard block
 block discarded – undo
64 64
 	 */
65 65
 	public function send()
66 66
 	{
67
-		if( !$this->message || !$this->subject || !$this->to )return;
67
+		if( !$this->message || !$this->subject || !$this->to ) {
68
+			return;
69
+		}
68 70
 		$sent = wp_mail(
69 71
 			$this->to,
70 72
 			$this->subject,
@@ -83,7 +85,9 @@  discard block
 block discarded – undo
83 85
 	 */
84 86
 	public function buildPlainTextMessage( $phpmailer )
85 87
 	{
86
-		if( $phpmailer->ContentType === 'text/plain' || !empty( $phpmailer->AltBody ))return;
88
+		if( $phpmailer->ContentType === 'text/plain' || !empty( $phpmailer->AltBody )) {
89
+			return;
90
+		}
87 91
 		$message = $this->stripHtmlTags( $phpmailer->Body );
88 92
 		$phpmailer->AltBody = apply_filters( 'site-reviews/email/message', $message, 'text', $this );
89 93
 	}
Please login to merge, or discard this patch.
plugin/Modules/Validator.php 1 patch
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -74,7 +74,9 @@  discard block
 block discarded – undo
74 74
 		foreach( $this->rules as $attribute => $rules ) {
75 75
 			foreach( $rules as $rule ) {
76 76
 				$this->validateAttribute( $attribute, $rule );
77
-				if( $this->shouldStopValidating( $attribute ))break;
77
+				if( $this->shouldStopValidating( $attribute )) {
78
+					break;
79
+				}
78 80
 			}
79 81
 		}
80 82
 		return $this->errors;
@@ -90,7 +92,9 @@  discard block
 block discarded – undo
90 92
 	public function validateAttribute( $attribute, $rule )
91 93
 	{
92 94
 		list( $rule, $parameters ) = $this->parseRule( $rule );
93
-		if( $rule == '' )return;
95
+		if( $rule == '' ) {
96
+			return;
97
+		}
94 98
 		$value = $this->getValue( $attribute );
95 99
 		$this->validateRequired( $attribute, $value ) || in_array( $rule, $this->implicitRules );
96 100
 		if( !method_exists( $this, $method = 'validate'.$rule )) {
@@ -163,7 +167,9 @@  discard block
 block discarded – undo
163 167
 	 */
164 168
 	protected function getRule( $attribute, $rules )
165 169
 	{
166
-		if( !array_key_exists( $attribute, $this->rules ))return;
170
+		if( !array_key_exists( $attribute, $this->rules )) {
171
+			return;
172
+		}
167 173
 		$rules = (array) $rules;
168 174
 		foreach( $this->rules[$attribute] as $rule ) {
169 175
 			list( $rule, $parameters ) = $this->parseRule( $rule );
@@ -314,7 +320,9 @@  discard block
 block discarded – undo
314 320
 		$message = isset( $strings[$key] )
315 321
 			? $strings[$key]
316 322
 			: false;
317
-		if( !$message )return;
323
+		if( !$message ) {
324
+			return;
325
+		}
318 326
 		$message = str_replace( ':attribute', $attribute, $message );
319 327
 		if( method_exists( $this, $replacer = 'replace'.$rule )) {
320 328
 			$message = $this->$replacer( $message, $parameters );
Please login to merge, or discard this patch.
plugin/Modules/Html/Builder.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -91,7 +91,9 @@  discard block
 block discarded – undo
91 91
 		];
92 92
 		if( !isset( $properties[$property] )
93 93
 			|| empty( array_filter( [$value], $properties[$property] ))
94
-		)return;
94
+		) {
95
+			return;
96
+		}
95 97
 		$this->$property = $value;
96 98
 	}
97 99
 
@@ -188,7 +190,9 @@  discard block
 block discarded – undo
188 190
 	 */
189 191
 	protected function buildFormLabel()
190 192
 	{
191
-		if( empty( $this->args['label'] ) || $this->args['type'] == 'hidden' )return;
193
+		if( empty( $this->args['label'] ) || $this->args['type'] == 'hidden' ) {
194
+			return;
195
+		}
192 196
 		return $this->label([
193 197
 			'for' => $this->args['id'],
194 198
 			'text' => $this->args['label'],
Please login to merge, or discard this patch.
plugin/Modules/Logger.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -190,7 +190,9 @@
 block discarded – undo
190 190
 		if( $index === false
191 191
 			|| !isset( $caller[$index+2]['class'] )
192 192
 			|| !isset( $caller[$index+2]['function'] )
193
-		)return;
193
+		) {
194
+			return;
195
+		}
194 196
 		return sprintf( '[%s()->%s:%s] ',
195 197
 			$caller[$index+2]['class'],
196 198
 			$caller[$index+2]['function'],
Please login to merge, or discard this patch.
activate.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -87,7 +87,9 @@
 block discarded – undo
87 87
 	 */
88 88
 	public function deactivate( $plugin )
89 89
 	{
90
-		if( static::isValid() )return;
90
+		if( static::isValid() ) {
91
+			return;
92
+		}
91 93
 		$pluginSlug = plugin_basename( static::$file );
92 94
 		if( $plugin == $pluginSlug ) {
93 95
 			$this->redirect(); //exit
Please login to merge, or discard this patch.
plugin/Database.php 1 patch
Braces   +15 added lines, -5 removed lines patch added patch discarded remove patch
@@ -67,7 +67,9 @@  discard block
 block discarded – undo
67 67
 	 */
68 68
 	public function getReview( $post )
69 69
 	{
70
-		if( !( $post instanceof WP_Post ) || $post->post_type != Application::POST_TYPE )return;
70
+		if( !( $post instanceof WP_Post ) || $post->post_type != Application::POST_TYPE ) {
71
+			return;
72
+		}
71 73
 		$review = $this->getReviewMeta( $post->ID );
72 74
 		$modified = $this->isReviewModified( $post, $review );
73 75
 		$review->content = $post->post_content;
@@ -241,7 +243,9 @@  discard block
 block discarded – undo
241 243
 		$termIds = array_map( 'trim', explode( ',', $termIds ));
242 244
 		foreach( $termIds as $termId ) {
243 245
 			$term = term_exists( $termId, Application::TAXONOMY );
244
-			if( !isset( $term['term_id'] ))continue;
246
+			if( !isset( $term['term_id'] )) {
247
+				continue;
248
+			}
245 249
 			$terms[] = intval( $term['term_id'] );
246 250
 		}
247 251
 		return $terms;
@@ -254,7 +258,9 @@  discard block
 block discarded – undo
254 258
 	public function revertReview( $postId )
255 259
 	{
256 260
 		$post = get_post( $postId );
257
-		if( !( $post instanceof WP_Post ) || $post->post_type != Application::POST_TYPE )return;
261
+		if( !( $post instanceof WP_Post ) || $post->post_type != Application::POST_TYPE ) {
262
+			return;
263
+		}
258 264
 		delete_post_meta( $post->ID, '_edit_last' );
259 265
 		$result = wp_update_post([
260 266
 			'ID' => $post->ID,
@@ -289,7 +295,9 @@  discard block
 block discarded – undo
289 295
 		add_filter( 'posts_search', [$queryBuilder, 'filterSearchByTitle'], 500, 2 );
290 296
 		$search = new WP_Query( $args );
291 297
 		remove_filter( 'posts_search', [$queryBuilder, 'filterSearchByTitle'], 500 );
292
-		if( !$search->have_posts() )return;
298
+		if( !$search->have_posts() ) {
299
+			return;
300
+		}
293 301
 		$results = '';
294 302
 		while( $search->have_posts() ) {
295 303
 			$search->the_post();
@@ -313,7 +321,9 @@  discard block
 block discarded – undo
313 321
 	public function setReviewMeta( $postId, $termIds )
314 322
 	{
315 323
 		$terms = $this->normalizeTerms( $termIds );
316
-		if( empty( $terms ))return;
324
+		if( empty( $terms )) {
325
+			return;
326
+		}
317 327
 		$result = wp_set_object_terms( $postId, $terms, Application::TAXONOMY );
318 328
 		if( is_wp_error( $result )) {
319 329
 			glsr_log()->error( $result->get_error_message() );
Please login to merge, or discard this patch.
plugin/Controllers/PublicController.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -62,7 +62,9 @@
 block discarded – undo
62 62
 		if( !empty( $validated->error )) {
63 63
 			return $validated->request;
64 64
 		}
65
-		if( $validated->recaptchaIsUnset )return;
65
+		if( $validated->recaptchaIsUnset ) {
66
+			return;
67
+		}
66 68
 		return $this->execute( new CreateReview( $validated->request ));
67 69
 	}
68 70
 }
Please login to merge, or discard this patch.
plugin/Handlers/CreateReview.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -115,7 +115,9 @@  discard block
 block discarded – undo
115 115
 	protected function sendNotification( $post_id, Command $command )
116 116
 	{
117 117
 		$notificationType = glsr( OptionManager::class )->get( 'settings.general.notification' );
118
-		if( !in_array( $notificationType, ['default','custom','webhook'] ))return;
118
+		if( !in_array( $notificationType, ['default','custom','webhook'] )) {
119
+			return;
120
+		}
119 121
 		$assignedToTitle = get_the_title( (int) $command->assignedTo );
120 122
 		$notificationSubject = _nx(
121 123
 			'New %s-star review',
@@ -162,7 +164,9 @@  discard block
 block discarded – undo
162 164
 	 */
163 165
 	protected function sendWebhookNotification( Command $command, array $args )
164 166
 	{
165
-		if( !( $endpoint = glsr( OptionManager::class )->get( 'settings.general.webhook_url' )))return;
167
+		if( !( $endpoint = glsr( OptionManager::class )->get( 'settings.general.webhook_url' ))) {
168
+			return;
169
+		}
166 170
 		$notification = $this->createWebhookNotification( $command, $args );
167 171
 		$result = wp_remote_post( $endpoint, [
168 172
 			'method' => 'POST',
Please login to merge, or discard this patch.
plugin/Shortcodes/ButtonGenerator.php 1 patch
Braces   +18 added lines, -6 removed lines patch added patch discarded remove patch
@@ -57,9 +57,13 @@  discard block
 block discarded – undo
57 57
 	protected function generateFields( array $fields )
58 58
 	{
59 59
 		$generatedFields = array_map( function( $field ) {
60
-			if( empty( $field ))return;
60
+			if( empty( $field )) {
61
+				return;
62
+			}
61 63
 			$field = $this->normalize( $field );
62
-			if( !method_exists( $this, $method = 'normalize'.ucfirst( $field['type'] )))return;
64
+			if( !method_exists( $this, $method = 'normalize'.ucfirst( $field['type'] ))) {
65
+				return;
66
+			}
63 67
 			return $this->$method( $field );
64 68
 		}, $fields );
65 69
 		return array_values( array_filter( $generatedFields ));
@@ -74,7 +78,9 @@  discard block
 block discarded – undo
74 78
 		if( !empty( $this->errors )) {
75 79
 			$errors = [];
76 80
 			foreach( $this->required as $name => $alert ) {
77
-				if( false !== array_search( $name, array_column( $fields, 'name' )))continue;
81
+				if( false !== array_search( $name, array_column( $fields, 'name' ))) {
82
+					continue;
83
+				}
78 84
 				$errors[] = $this->errors[$name];
79 85
 			}
80 86
 			$this->errors = $errors;
@@ -118,7 +124,9 @@  discard block
 block discarded – undo
118 124
 	 */
119 125
 	protected function normalizeContainer( array $field )
120 126
 	{
121
-		if( !array_key_exists( 'html', $field ) && !array_key_exists( 'items', $field ))return;
127
+		if( !array_key_exists( 'html', $field ) && !array_key_exists( 'items', $field )) {
128
+			return;
129
+		}
122 130
 		$field['items'] = $this->generateFields( $field['items'] );
123 131
 		return $field;
124 132
 	}
@@ -128,7 +136,9 @@  discard block
 block discarded – undo
128 136
 	 */
129 137
 	protected function normalizeField( array $field, array $defaults )
130 138
 	{
131
-		if( !$this->validate( $field ))return;
139
+		if( !$this->validate( $field )) {
140
+			return;
141
+		}
132 142
 		return array_filter( shortcode_atts( $defaults, $field ), function( $value ) {
133 143
 			return $value !== '';
134 144
 		});
@@ -149,7 +159,9 @@  discard block
 block discarded – undo
149 159
 			'type' => '',
150 160
 			'value' => '',
151 161
 		]);
152
-		if( !is_array( $listbox ))return;
162
+		if( !is_array( $listbox )) {
163
+			return;
164
+		}
153 165
 		if( !array_key_exists( '', $listbox['options'] )) {
154 166
 			$listbox['options'] = ['' => $listbox['placeholder']] + $listbox['options'];
155 167
 		}
Please login to merge, or discard this patch.