Passed
Push — master ( 223132...471f83 )
by Paul
05:10
created
plugin/Database/QueryBuilder.php 1 patch
Braces   +18 added lines, -6 removed lines patch added patch discarded remove patch
@@ -16,9 +16,13 @@  discard block
 block discarded – undo
16 16
 	{
17 17
 		$queries = [];
18 18
 		foreach( $keys as $key ) {
19
-			if( !array_key_exists( $key, $values ))continue;
19
+			if( !array_key_exists( $key, $values )) {
20
+				continue;
21
+			}
20 22
 			$methodName = glsr( Helper::class )->buildMethodName( $key, $prefix = __METHOD__ );
21
-			if( !method_exists( $this, $methodName ))continue;
23
+			if( !method_exists( $this, $methodName )) {
24
+				continue;
25
+			}
22 26
 			$query = call_user_func( [$this, $methodName], $values[$key] );
23 27
 			if( is_array( $query )) {
24 28
 				$queries[] = $query;
@@ -90,7 +94,9 @@  discard block
 block discarded – undo
90 94
 	 */
91 95
 	protected function buildQueryAssignedTo( $value )
92 96
 	{
93
-		if( empty( $value ))return;
97
+		if( empty( $value )) {
98
+			return;
99
+		}
94 100
 		return [
95 101
 			'compare' => 'IN',
96 102
 			'key' => 'assigned_to',
@@ -104,7 +110,9 @@  discard block
 block discarded – undo
104 110
 	 */
105 111
 	protected function buildQueryCategory( $value )
106 112
 	{
107
-		if( empty( $value ))return;
113
+		if( empty( $value )) {
114
+			return;
115
+		}
108 116
 		return [
109 117
 			'field' => 'term_id',
110 118
 			'taxonomy' => Application::TAXONOMY,
@@ -118,7 +126,9 @@  discard block
 block discarded – undo
118 126
 	 */
119 127
 	protected function buildQueryRating( $value )
120 128
 	{
121
-		if( !is_numeric( $value ) || !in_array( intval( $value ), range( 1, 5 )))return;
129
+		if( !is_numeric( $value ) || !in_array( intval( $value ), range( 1, 5 ))) {
130
+			return;
131
+		}
122 132
 		return [
123 133
 			'compare' => '>=',
124 134
 			'key' => 'rating',
@@ -132,7 +142,9 @@  discard block
 block discarded – undo
132 142
 	 */
133 143
 	protected function buildQueryType( $value )
134 144
 	{
135
-		if( in_array( $value, ['','all'] ))return;
145
+		if( in_array( $value, ['','all'] )) {
146
+			return;
147
+		}
136 148
 		return [
137 149
 			'key' => 'review_type',
138 150
 			'value' => $value,
Please login to merge, or discard this patch.
helpers.php 1 patch
Braces   +16 added lines, -8 removed lines patch added patch discarded remove patch
@@ -4,7 +4,8 @@  discard block
 block discarded – undo
4 4
 /**
5 5
  * @return mixed
6 6
  */
7
-function glsr( $alias = null ) {
7
+function glsr( $alias = null )
8
+{
8 9
 	$app = \GeminiLabs\SiteReviews\Application::load();
9 10
 	return empty( $alias )
10 11
 		? $app
@@ -15,7 +16,8 @@  discard block
 block discarded – undo
15 16
  * get_current_screen() is unreliable because it is not defined on all admin pages
16 17
  * @return \WP_Screen|object
17 18
  */
18
-function glsr_current_screen() {
19
+function glsr_current_screen()
20
+{
19 21
 	if( function_exists( 'get_current_screen' )) {
20 22
 		$screen = get_current_screen();
21 23
 	}
@@ -27,7 +29,8 @@  discard block
 block discarded – undo
27 29
 /**
28 30
  * @return \GeminiLabs\SiteReviews\Database
29 31
  */
30
-function glsr_db() {
32
+function glsr_db()
33
+{
31 34
 	return glsr( 'Database' );
32 35
 }
33 36
 
@@ -35,7 +38,8 @@  discard block
 block discarded – undo
35 38
  * @param mixed ...$vars
36 39
  * @return void
37 40
  */
38
-function glsr_debug( ...$vars ) {
41
+function glsr_debug( ...$vars )
42
+{
39 43
 	if( count( $vars ) == 1 ) {
40 44
 		$value = htmlspecialchars( print_r( $vars[0], true ), ENT_QUOTES, 'UTF-8' );
41 45
 		printf( '<div class="glsr-debug"><pre>%s</pre></div>', $value );
@@ -52,7 +56,8 @@  discard block
 block discarded – undo
52 56
 /**
53 57
  * @return \GeminiLabs\SiteReviews\Modules\Logger
54 58
  */
55
-function glsr_log() {
59
+function glsr_log()
60
+{
56 61
 	$args = func_get_args();
57 62
 	$context = isset( $args[1] )
58 63
 		? $args[1]
@@ -68,7 +73,8 @@  discard block
 block discarded – undo
68 73
  * @return void
69 74
  * @callback register_taxonomy() "meta_box_cb"
70 75
  */
71
-function glsr_categories_meta_box( $post, $box ) {
76
+function glsr_categories_meta_box( $post, $box )
77
+{
72 78
 	glsr( 'Controllers\EditorController' )->renderTaxonomyMetabox( $post, $box );
73 79
 }
74 80
 
@@ -77,14 +83,16 @@  discard block
 block discarded – undo
77 83
  * @param mixed $fallback
78 84
  * @return string|array
79 85
  */
80
-function glsr_get_option( $option_path = '', $fallback = '' ) {
86
+function glsr_get_option( $option_path = '', $fallback = '' )
87
+{
81 88
 	return glsr( 'Database\OptionManager' )->get( 'settings.'.$option_path, $fallback );
82 89
 }
83 90
 
84 91
 /**
85 92
  * @return array
86 93
  */
87
-function glsr_get_options() {
94
+function glsr_get_options()
95
+{
88 96
 	return glsr( 'Database\OptionManager' )->get( 'settings' );
89 97
 }
90 98
 
Please login to merge, or discard this patch.
plugin/Router.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -16,7 +16,9 @@  discard block
 block discarded – undo
16 16
 	public function routeAdminPostRequest()
17 17
 	{
18 18
 		$request = filter_input( INPUT_POST, Application::ID, FILTER_DEFAULT, FILTER_REQUIRE_ARRAY );
19
-		if( !isset( $request['action'] ))return;
19
+		if( !isset( $request['action'] )) {
20
+			return;
21
+		}
20 22
 		$this->checkNonce( $request['action'] );
21 23
 		switch( $request['action'] ) {
22 24
 			case 'clear-log':
@@ -75,7 +77,9 @@  discard block
 block discarded – undo
75 77
 	public function routeWebhookRequest()
76 78
 	{
77 79
 		$request = filter_input( INPUT_GET, sprintf( '%s-hook', Application::ID ));
78
-		if( !$request )return;
80
+		if( !$request ) {
81
+			return;
82
+		}
79 83
 		// @todo manage webhook here
80 84
 	}
81 85
 
Please login to merge, or discard this patch.
plugin/Controllers/Controller.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,9 @@
 block discarded – undo
15 15
 	 */
16 16
 	public function download( $filename, $content )
17 17
 	{
18
-		if( !current_user_can( Application::CAPABILITY ))return;
18
+		if( !current_user_can( Application::CAPABILITY )) {
19
+			return;
20
+		}
19 21
 		nocache_headers();
20 22
 		header( 'Content-Type: text/plain' );
21 23
 		header( 'Content-Disposition: attachment; filename="'.$filename.'"' );
Please login to merge, or discard this patch.
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/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.