Passed
Push — master ( 235569...65c96d )
by Paul
03:43
created
plugin/Modules/Notification.php 2 patches
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 	public function __construct()
34 34
 	{
35 35
 		$types = glsr( OptionManager::class )->get( 'settings.general.notifications', [] );
36
-		$this->email = count( array_intersect( ['admin', 'custom'], $types )) > 0;
36
+		$this->email = count( array_intersect( ['admin', 'custom'], $types ) ) > 0;
37 37
 		$this->slack = in_array( 'slack', $types );
38 38
 		$this->types = $types;
39 39
 	}
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 	 */
44 44
 	public function send( Review $review )
45 45
 	{
46
-		if( empty( $this->types ))return;
46
+		if( empty($this->types) )return;
47 47
 		$this->review = $review;
48 48
 		$args = [
49 49
 			'link' => $this->getLink(),
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 	 */
59 59
 	protected function buildEmail( array $args )
60 60
 	{
61
-		return glsr( Email::class )->compose([
61
+		return glsr( Email::class )->compose( [
62 62
 			'to' => $this->getEmailAddresses(),
63 63
 			'subject' => $args['title'],
64 64
 			'template' => 'email-notification',
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 				'review_rating' => $this->review->rating,
72 72
 				'review_title' => $this->review->title,
73 73
 			],
74
-		]);
74
+		] );
75 75
 	}
76 76
 
77 77
 	/**
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 			'button_url' => $args['link'],
84 84
 			'fallback' => $this->buildEmail( $args )->read( 'plaintext' ),
85 85
 			'pretext' => $args['title'],
86
-		]);
86
+		] );
87 87
 	}
88 88
 
89 89
 	/**
@@ -92,23 +92,23 @@  discard block
 block discarded – undo
92 92
 	protected function getEmailAddresses()
93 93
 	{
94 94
 		$emails = [];
95
-		if( in_array( 'admin', $this->types )) {
95
+		if( in_array( 'admin', $this->types ) ) {
96 96
 			$emails[] = get_option( 'admin_email' );
97 97
 		}
98
-		if( in_array( 'author', $this->types )) {
99
-			$assignedPost = get_post( intval( $this->review->assigned_to ));
98
+		if( in_array( 'author', $this->types ) ) {
99
+			$assignedPost = get_post( intval( $this->review->assigned_to ) );
100 100
 			if( $assignedPost instanceof WP_Post ) {
101 101
 				$this->email = true;
102
-				$emails[] = get_the_author_meta( 'user_email', intval( $assignedPost->post_author ));
102
+				$emails[] = get_the_author_meta( 'user_email', intval( $assignedPost->post_author ) );
103 103
 			}
104 104
 		}
105
-		if( in_array( 'custom', $this->types )) {
105
+		if( in_array( 'custom', $this->types ) ) {
106 106
 			$customEmails = glsr( OptionManager::class )->get( 'settings.general.notification_email' );
107 107
 			$customEmails = str_replace( [' ', ',', ';'], ',', $customEmails );
108 108
 			$customEmails = explode( ',', $customEmails );
109 109
 			$emails = array_merge( $emails, $customEmails );
110 110
 		}
111
-		$emails = array_filter( array_keys( array_flip( $emails )));
111
+		$emails = array_filter( array_keys( array_flip( $emails ) ) );
112 112
 		return apply_filters( 'site-reviews/notification/emails', $emails, $this->review );
113 113
 	}
114 114
 
@@ -125,16 +125,16 @@  discard block
 block discarded – undo
125 125
 	 */
126 126
 	protected function getTitle()
127 127
 	{
128
-		$assignedTitle = get_the_title( intval( $this->review->assigned_to ));
128
+		$assignedTitle = get_the_title( intval( $this->review->assigned_to ) );
129 129
 		$title = _nx(
130 130
 			'New %s-star review',
131 131
 			'New %s-star review of: %s',
132
-			intval( empty( $assignedTitle )),
132
+			intval( empty($assignedTitle) ),
133 133
 			'This string differs depending on whether or not the review has been assigned to a post.',
134 134
 			'site-reviews'
135 135
 		);
136 136
 		$title = sprintf( '[%s] %s',
137
-			wp_specialchars_decode( strval( get_option( 'blogname' )), ENT_QUOTES ),
137
+			wp_specialchars_decode( strval( get_option( 'blogname' ) ), ENT_QUOTES ),
138 138
 			sprintf( $title, $this->review->rating, $assignedTitle )
139 139
 		);
140 140
 		return apply_filters( 'site-reviews/notification/title', $title, $this->review );
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
 	{
148 148
 		$email = $this->buildEmail( $args );
149 149
 		if( !$this->email )return;
150
-		if( empty( $email->to )) {
150
+		if( empty($email->to) ) {
151 151
 			glsr_log()->error( 'Email notification was not sent: missing email address' );
152 152
 			return;
153 153
 		}
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
 		if( !$this->slack )return;
165 165
 		$notification = $this->buildSlackNotification( $args );
166 166
 		$result = $notification->send();
167
-		if( is_wp_error( $result )) {
167
+		if( is_wp_error( $result ) ) {
168 168
 			$notification->review = null;
169 169
 			glsr_log()->error( $result->get_error_message() )->debug( $notification );
170 170
 		}
Please login to merge, or discard this patch.
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -43,7 +43,9 @@  discard block
 block discarded – undo
43 43
 	 */
44 44
 	public function send( Review $review )
45 45
 	{
46
-		if( empty( $this->types ))return;
46
+		if( empty( $this->types )) {
47
+			return;
48
+		}
47 49
 		$this->review = $review;
48 50
 		$args = [
49 51
 			'link' => $this->getLink(),
@@ -146,7 +148,9 @@  discard block
 block discarded – undo
146 148
 	protected function sendToEmail( array $args )
147 149
 	{
148 150
 		$email = $this->buildEmail( $args );
149
-		if( !$this->email )return;
151
+		if( !$this->email ) {
152
+			return;
153
+		}
150 154
 		if( empty( $email->to )) {
151 155
 			glsr_log()->error( 'Email notification was not sent: missing email address' );
152 156
 			return;
@@ -161,7 +165,9 @@  discard block
 block discarded – undo
161 165
 	 */
162 166
 	protected function sendToSlack( array $args )
163 167
 	{
164
-		if( !$this->slack )return;
168
+		if( !$this->slack ) {
169
+			return;
170
+		}
165 171
 		$notification = $this->buildSlackNotification( $args );
166 172
 		$result = $notification->send();
167 173
 		if( is_wp_error( $result )) {
Please login to merge, or discard this patch.
plugin/Modules/Blacklist.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -11,13 +11,13 @@  discard block
 block discarded – undo
11 11
 	 */
12 12
 	public function isBlacklisted( array $review )
13 13
 	{
14
-		$target = implode( "\n", array_filter([
14
+		$target = implode( "\n", array_filter( [
15 15
 			$review['name'],
16 16
 			$review['content'],
17 17
 			$review['email'],
18 18
 			$review['ip_address'],
19 19
 			$review['title'],
20
-		]));
20
+		] ) );
21 21
 		return (bool)apply_filters( 'site-reviews/blacklist/is-blacklisted',
22 22
 			$this->check( $target ),
23 23
 			$review
@@ -30,16 +30,16 @@  discard block
 block discarded – undo
30 30
 	 */
31 31
 	protected function check( $target )
32 32
 	{
33
-		$blacklist = trim( glsr( OptionManager::class )->get( 'settings.submissions.blacklist.entries' ));
34
-		if( empty( $blacklist )) {
33
+		$blacklist = trim( glsr( OptionManager::class )->get( 'settings.submissions.blacklist.entries' ) );
34
+		if( empty($blacklist) ) {
35 35
 			return false;
36 36
 		}
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;
41
-			$pattern = sprintf( '#%s#i', preg_quote( $line, '#' ));
42
-			if( preg_match( $pattern, $target )) {
40
+			if( empty($line) || 256 < strlen( $line ) )continue;
41
+			$pattern = sprintf( '#%s#i', preg_quote( $line, '#' ) );
42
+			if( preg_match( $pattern, $target ) ) {
43 43
 				return true;
44 44
 			}
45 45
 		}
Please login to merge, or discard this patch.
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.
plugin/Modules/Html/ReviewHtml.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@
 block discarded – undo
19 19
 	 */
20 20
 	public function __get( $key )
21 21
 	{
22
-		if( array_key_exists( $key, $this->values )) {
22
+		if( array_key_exists( $key, $this->values ) ) {
23 23
 			return $this->values[$key];
24 24
 		}
25 25
 		return '';
Please login to merge, or discard this patch.
plugin/Review.php 2 patches
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.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -46,10 +46,10 @@  discard block
 block discarded – undo
46 46
 	 */
47 47
 	public function __get( $key )
48 48
 	{
49
-		if( property_exists( $this, $key )) {
49
+		if( property_exists( $this, $key ) ) {
50 50
 			return $this->$key;
51 51
 		}
52
-		if( is_array( $this->custom ) && array_key_exists( $key, $this->custom )) {
52
+		if( is_array( $this->custom ) && array_key_exists( $key, $this->custom ) ) {
53 53
 			return $this->custom[$key];
54 54
 		}
55 55
 		return '';
@@ -77,13 +77,13 @@  discard block
 block discarded – undo
77 77
 			'review_type' => '',
78 78
 		];
79 79
 		$meta = array_filter(
80
-			array_map( 'array_shift', (array)get_post_meta( $post->ID )),
80
+			array_map( 'array_shift', (array)get_post_meta( $post->ID ) ),
81 81
 			'strlen'
82 82
 		);
83
-		$properties = glsr( CreateReviewDefaults::class )->restrict( array_merge( $defaults, $meta ));
83
+		$properties = glsr( CreateReviewDefaults::class )->restrict( array_merge( $defaults, $meta ) );
84 84
 		$this->modified = $this->isModified( $properties );
85 85
 		array_walk( $properties, function( $value, $key ) {
86
-			if( !property_exists( $this, $key ) || isset( $this->$key ))return;
86
+			if( !property_exists( $this, $key ) || isset($this->$key) )return;
87 87
 			$this->$key = maybe_unserialize( $value );
88 88
 		});
89 89
 	}
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 	protected function setTermIds( WP_Post $post )
95 95
 	{
96 96
 		$this->term_ids = [];
97
-		if( !is_array( $terms = get_the_terms( $post, Application::TAXONOMY )))return;
97
+		if( !is_array( $terms = get_the_terms( $post, Application::TAXONOMY ) ) )return;
98 98
 		foreach( $terms as $term ) {
99 99
 			$this->term_ids[] = $term->term_id;
100 100
 		}
Please login to merge, or discard this patch.
plugin/Defaults/DefaultsAbstract.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 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 ) )return;
17 17
 		$defaults = call_user_func_array( [$this, $name], $args );
18 18
 		$hookName = (new ReflectionClass( $this ))->getShortName();
19 19
 		$hookName = str_replace( 'Defaults', '', $hookName );
Please login to merge, or discard this 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/Modules/Console.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 	 */
109 109
 	public function get()
110 110
 	{
111
-		return empty( $this->log )
111
+		return empty($this->log)
112 112
 			? __( 'Console is empty', 'site-reviews' )
113 113
 			: $this->log;
114 114
 	}
@@ -120,11 +120,11 @@  discard block
 block discarded – undo
120 120
 	public function humanSize( $valueIfEmpty = null )
121 121
 	{
122 122
 		$bytes = $this->size();
123
-		if( empty( $bytes ) && is_string( $valueIfEmpty )) {
123
+		if( empty($bytes) && is_string( $valueIfEmpty ) ) {
124 124
 			return $valueIfEmpty;
125 125
 		}
126
-		$exponent = floor( log( max( $bytes, 1 ), 1024 ));
127
-		return round( $bytes / pow( 1024, $exponent ), 2 ).' '.['bytes','KB','MB','GB'][$exponent];
126
+		$exponent = floor( log( max( $bytes, 1 ), 1024 ) );
127
+		return round( $bytes / pow( 1024, $exponent ), 2 ).' '.['bytes', 'KB', 'MB', 'GB'][$exponent];
128 128
 	}
129 129
 
130 130
 	/**
@@ -147,9 +147,9 @@  discard block
 block discarded – undo
147 147
 	public function log( $level, $message, array $context = [] )
148 148
 	{
149 149
 		$constants = (new ReflectionClass( __CLASS__ ))->getConstants();
150
-		if( in_array( $level, $constants, true )) {
150
+		if( in_array( $level, $constants, true ) ) {
151 151
 			$entry = $this->buildLogEntry( $level, $message, $context );
152
-			file_put_contents( $this->file, $entry, FILE_APPEND|LOCK_EX );
152
+			file_put_contents( $this->file, $entry, FILE_APPEND | LOCK_EX );
153 153
 			$this->reset();
154 154
 		}
155 155
 		return $this;
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
 	 */
223 223
 	protected function interpolate( $message, $context = [] )
224 224
 	{
225
-		if( $this->isObjectOrArray( $message ) || !is_array( $context )) {
225
+		if( $this->isObjectOrArray( $message ) || !is_array( $context ) ) {
226 226
 			return print_r( $message, true );
227 227
 		}
228 228
 		$replace = [];
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
 		if( $value instanceof DateTime ) {
251 251
 			$value = $value->format( 'Y-m-d H:i:s' );
252 252
 		}
253
-		else if( $this->isObjectOrArray( $value )) {
253
+		else if( $this->isObjectOrArray( $value ) ) {
254 254
 			$value = json_encode( $value );
255 255
 		}
256 256
 		return (string)$value;
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
 			$this->clear();
266 266
 			file_put_contents(
267 267
 				$this->file,
268
-				$this->buildLogEntry( 'info', __( 'Console was automatically cleared (128 KB maximum size)', 'site-reviews' ))
268
+				$this->buildLogEntry( 'info', __( 'Console was automatically cleared (128 KB maximum size)', 'site-reviews' ) )
269 269
 			);
270 270
 		}
271 271
 	}
Please login to merge, or discard this patch.
plugin/Database/QueryBuilder.php 2 patches
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.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -17,11 +17,11 @@  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 ) )continue;
21 21
 			$methodName = glsr( Helper::class )->buildMethodName( $key, __FUNCTION__ );
22
-			if( !method_exists( $this, $methodName ))continue;
22
+			if( !method_exists( $this, $methodName ) )continue;
23 23
 			$query = call_user_func( [$this, $methodName], $values[$key] );
24
-			if( is_array( $query )) {
24
+			if( is_array( $query ) ) {
25 25
 				$queries[] = $query;
26 26
 			}
27 27
 		}
@@ -36,10 +36,10 @@  discard block
 block discarded – undo
36 36
 		$string = '';
37 37
 		$values = array_filter( $values );
38 38
 		foreach( $conditions as $key => $value ) {
39
-			if( !isset( $values[$key] ))continue;
39
+			if( !isset($values[$key]) )continue;
40 40
 			$values[$key] = implode( ',', (array)$values[$key] );
41 41
 			$string .= strpos( $value, '%s' ) !== false
42
-				? sprintf( $value, strval( $values[$key] ))
42
+				? sprintf( $value, strval( $values[$key] ) )
43 43
 				: $value;
44 44
 		}
45 45
 		return $string;
@@ -53,11 +53,11 @@  discard block
 block discarded – undo
53 53
 	 */
54 54
 	public function buildSqlOr( $values, $sprintfFormat )
55 55
 	{
56
-		if( !is_array( $values )) {
56
+		if( !is_array( $values ) ) {
57 57
 			$values = explode( ',', $values );
58 58
 		}
59
-		$values = array_filter( array_map( 'trim', (array)$values ));
60
-		$values = array_map( function( $value ) use( $sprintfFormat ) {
59
+		$values = array_filter( array_map( 'trim', (array)$values ) );
60
+		$values = array_map( function( $value ) use($sprintfFormat) {
61 61
 			return sprintf( $sprintfFormat, $value );
62 62
 		}, $values );
63 63
 		return implode( ' OR ', $values );
@@ -72,11 +72,11 @@  discard block
 block discarded – undo
72 72
 	 */
73 73
 	public function filterSearchByTitle( $search, WP_Query $query )
74 74
 	{
75
-		if( empty( $search ) || empty( $query->get( 'search_terms' ))) {
75
+		if( empty($search) || empty($query->get( 'search_terms' )) ) {
76 76
 			return $search;
77 77
 		}
78 78
 		global $wpdb;
79
-		$n = empty( $query->get( 'exact' ))
79
+		$n = empty($query->get( 'exact' ))
80 80
 			? '%'
81 81
 			: '';
82 82
 		$search = [];
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 			? glsr()->constant( 'PAGED_QUERY_VAR' )
101 101
 			: 'page';
102 102
 		return $isEnabled
103
-			? max( 1, intval( get_query_var( $pagedQuery )))
103
+			? max( 1, intval( get_query_var( $pagedQuery ) ) )
104 104
 			: 1;
105 105
 	}
106 106
 
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 	 */
111 111
 	protected function buildQueryAssignedTo( $value )
112 112
 	{
113
-		if( empty( $value ))return;
113
+		if( empty($value) )return;
114 114
 		$postIds = glsr( Helper::class )->convertStringToArray( $value, 'is_numeric' );
115 115
 		return [
116 116
 			'compare' => 'IN',
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
 	 */
126 126
 	protected function buildQueryCategory( $value )
127 127
 	{
128
-		if( empty( $value ))return;
128
+		if( empty($value) )return;
129 129
 		return [
130 130
 			'field' => 'term_id',
131 131
 			'taxonomy' => Application::TAXONOMY,
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
 	 */
140 140
 	protected function buildQueryRating( $value )
141 141
 	{
142
-		if( !is_numeric( $value ) || !in_array( intval( $value ), range( 1, 5 )))return;
142
+		if( !is_numeric( $value ) || !in_array( intval( $value ), range( 1, 5 ) ) )return;
143 143
 		return [
144 144
 			'compare' => '>=',
145 145
 			'key' => 'rating',
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
 	 */
154 154
 	protected function buildQueryType( $value )
155 155
 	{
156
-		if( in_array( $value, ['','all'] ))return;
156
+		if( in_array( $value, ['', 'all'] ) )return;
157 157
 		return [
158 158
 			'key' => 'review_type',
159 159
 			'value' => $value,
Please login to merge, or discard this patch.
plugin/Modules/Html/Partials/SiteReviewsSummary.php 2 patches
Braces   +18 added lines, -6 removed lines patch added patch discarded remove patch
@@ -41,7 +41,9 @@  discard block
 block discarded – undo
41 41
 		$this->ratingCounts = glsr( CountsManager::class )->flatten( $counts, [
42 42
 			'min' => $args['rating'],
43 43
 		]);
44
-		if( !array_sum( $this->ratingCounts ) && $this->isHidden( 'if_empty' ))return;
44
+		if( !array_sum( $this->ratingCounts ) && $this->isHidden( 'if_empty' )) {
45
+			return;
46
+		}
45 47
 		$this->averageRating = glsr( Rating::class )->getAverage( $this->ratingCounts );
46 48
 		$this->generateSchema();
47 49
 		return glsr( Template::class )->build( 'templates/reviews-summary', [
@@ -61,7 +63,9 @@  discard block
 block discarded – undo
61 63
 	 */
62 64
 	protected function buildPercentage()
63 65
 	{
64
-		if( $this->isHidden( 'bars' ))return;
66
+		if( $this->isHidden( 'bars' )) {
67
+			return;
68
+		}
65 69
 		$percentages = preg_filter( '/$/', '%', glsr( Rating::class )->getPercentages( $this->ratingCounts ));
66 70
 		$bars = array_reduce( range( Rating::MAX_RATING, 1 ), function( $carry, $level ) use( $percentages ) {
67 71
 			$label = $this->buildPercentageLabel( $this->args['labels'][$level] );
@@ -110,7 +114,9 @@  discard block
 block discarded – undo
110 114
 	 */
111 115
 	protected function buildRating()
112 116
 	{
113
-		if( $this->isHidden( 'rating' ))return;
117
+		if( $this->isHidden( 'rating' )) {
118
+			return;
119
+		}
114 120
 		return $this->wrap( 'rating', '<span>'.$this->averageRating.'</span>' );
115 121
 	}
116 122
 
@@ -119,7 +125,9 @@  discard block
 block discarded – undo
119 125
 	 */
120 126
 	protected function buildStars()
121 127
 	{
122
-		if( $this->isHidden( 'stars' ))return;
128
+		if( $this->isHidden( 'stars' )) {
129
+			return;
130
+		}
123 131
 		$stars = glsr( Partial::class )->build( 'star-rating', ['rating' => $this->averageRating] );
124 132
 		return $this->wrap( 'stars', $stars );
125 133
 	}
@@ -129,7 +137,9 @@  discard block
 block discarded – undo
129 137
 	 */
130 138
 	protected function buildText()
131 139
 	{
132
-		if( $this->isHidden( 'summary' ))return;
140
+		if( $this->isHidden( 'summary' )) {
141
+			return;
142
+		}
133 143
 		$count = intval( array_sum( $this->ratingCounts ));
134 144
 		if( empty( $this->args['text'] )) {
135 145
 			// @todo document this change
@@ -154,7 +164,9 @@  discard block
 block discarded – undo
154 164
 	 */
155 165
 	protected function generateSchema()
156 166
 	{
157
-		if( !wp_validate_boolean( $this->args['schema'] ))return;
167
+		if( !wp_validate_boolean( $this->args['schema'] )) {
168
+			return;
169
+		}
158 170
 		glsr( Schema::class )->store(
159 171
 			glsr( Schema::class )->buildSummary( $this->args )
160 172
 		);
Please login to merge, or discard this patch.
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -35,15 +35,15 @@  discard block
 block discarded – undo
35 35
 	public function build( array $args = [] )
36 36
 	{
37 37
 		$this->args = $args;
38
-		$counts = glsr( CountsManager::class )->get([
38
+		$counts = glsr( CountsManager::class )->get( [
39 39
 			'post_ids' => glsr( Helper::class )->convertStringToArray( $args['assigned_to'] ),
40 40
 			'term_ids' => glsr( ReviewManager::class )->normalizeTerms( $args['category'] ),
41 41
 			'type' => $args['type'],
42
-		]);
42
+		] );
43 43
 		$this->ratingCounts = glsr( CountsManager::class )->flatten( $counts, [
44 44
 			'min' => $args['rating'],
45
-		]);
46
-		if( !array_sum( $this->ratingCounts ) && $this->isHidden( 'if_empty' ))return;
45
+		] );
46
+		if( !array_sum( $this->ratingCounts ) && $this->isHidden( 'if_empty' ) )return;
47 47
 		$this->averageRating = glsr( Rating::class )->getAverage( $this->ratingCounts );
48 48
 		$this->generateSchema();
49 49
 		return glsr( Template::class )->build( 'templates/reviews-summary', [
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 				'stars' => $this->buildStars(),
56 56
 				'text' => $this->buildText(),
57 57
 			],
58
-		]);
58
+		] );
59 59
 	}
60 60
 
61 61
 	/**
@@ -63,9 +63,9 @@  discard block
 block discarded – undo
63 63
 	 */
64 64
 	protected function buildPercentage()
65 65
 	{
66
-		if( $this->isHidden( 'bars' ))return;
67
-		$percentages = preg_filter( '/$/', '%', glsr( Rating::class )->getPercentages( $this->ratingCounts ));
68
-		$bars = array_reduce( range( Rating::MAX_RATING, 1 ), function( $carry, $level ) use( $percentages ) {
66
+		if( $this->isHidden( 'bars' ) )return;
67
+		$percentages = preg_filter( '/$/', '%', glsr( Rating::class )->getPercentages( $this->ratingCounts ) );
68
+		$bars = array_reduce( range( Rating::MAX_RATING, 1 ), function( $carry, $level ) use($percentages) {
69 69
 			$label = $this->buildPercentageLabel( $this->args['labels'][$level] );
70 70
 			$background = $this->buildPercentageBackground( $percentages[$level] );
71 71
 			$count = apply_filters( 'site-reviews/summary/counts',
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 			$percent = $this->buildPercentageCount( $count );
76 76
 			return $carry.glsr( Builder::class )->div( $label.$background.$percent, [
77 77
 				'class' => 'glsr-bar',
78
-			]);
78
+			] );
79 79
 		});
80 80
 		return $this->wrap( 'percentage', $bars );
81 81
 	}
@@ -86,10 +86,10 @@  discard block
 block discarded – undo
86 86
 	 */
87 87
 	protected function buildPercentageBackground( $percent )
88 88
 	{
89
-		$backgroundPercent = glsr( Builder::class )->span([
89
+		$backgroundPercent = glsr( Builder::class )->span( [
90 90
 			'class' => 'glsr-bar-background-percent',
91 91
 			'style' => 'width:'.$percent,
92
-		]);
92
+		] );
93 93
 		return '<span class="glsr-bar-background">'.$backgroundPercent.'</span>';
94 94
 	}
95 95
 
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 	 */
117 117
 	protected function buildRating()
118 118
 	{
119
-		if( $this->isHidden( 'rating' ))return;
119
+		if( $this->isHidden( 'rating' ) )return;
120 120
 		return $this->wrap( 'rating', '<span>'.$this->averageRating.'</span>' );
121 121
 	}
122 122
 
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
 	 */
126 126
 	protected function buildStars()
127 127
 	{
128
-		if( $this->isHidden( 'stars' ))return;
128
+		if( $this->isHidden( 'stars' ) )return;
129 129
 		$stars = glsr( Partial::class )->build( 'star-rating', ['rating' => $this->averageRating] );
130 130
 		return $this->wrap( 'stars', $stars );
131 131
 	}
@@ -135,9 +135,9 @@  discard block
 block discarded – undo
135 135
 	 */
136 136
 	protected function buildText()
137 137
 	{
138
-		if( $this->isHidden( 'summary' ))return;
139
-		$count = intval( array_sum( $this->ratingCounts ));
140
-		if( empty( $this->args['text'] )) {
138
+		if( $this->isHidden( 'summary' ) )return;
139
+		$count = intval( array_sum( $this->ratingCounts ) );
140
+		if( empty($this->args['text']) ) {
141 141
 			// @todo document this change
142 142
 			 $this->args['text'] = _nx(
143 143
 				'{rating} out of {max} stars (based on {num} review)',
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
 			);
149 149
 		}
150 150
 		$summary = str_replace(
151
-			['{rating}','{max}', '{num}'],
151
+			['{rating}', '{max}', '{num}'],
152 152
 			[$this->averageRating, Rating::MAX_RATING, $count],
153 153
 			$this->args['text']
154 154
 		);
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
 	 */
161 161
 	protected function generateSchema()
162 162
 	{
163
-		if( !wp_validate_boolean( $this->args['schema'] ))return;
163
+		if( !wp_validate_boolean( $this->args['schema'] ) )return;
164 164
 		glsr( Schema::class )->store(
165 165
 			glsr( Schema::class )->buildSummary( $this->args )
166 166
 		);
@@ -192,6 +192,6 @@  discard block
 block discarded – undo
192 192
 	{
193 193
 		return glsr( Builder::class )->div( $value, [
194 194
 			'class' => 'glsr-summary-'.$key,
195
-		]);
195
+		] );
196 196
 	}
197 197
 }
Please login to merge, or discard this patch.
plugin/Modules/Html/Partials/Pagination.php 2 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -20,7 +20,9 @@
 block discarded – undo
20 20
 	public function build( array $args = [] )
21 21
 	{
22 22
 		$this->args = $this->normalize( $args );
23
-		if( $this->args['total'] < 2 )return;
23
+		if( $this->args['total'] < 2 ) {
24
+			return;
25
+		}
24 26
 		return glsr( Template::class )->build( 'templates/pagination', [
25 27
 			'context' => [
26 28
 				'links' => apply_filters( 'site-reviews/paginate_links', $this->buildLinks(), $this->args ),
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 				'loader' => '<div class="glsr-loader"></div>',
28 28
 				'screen_reader_text' => __( 'Site Reviews navigation', 'site-reviews' ),
29 29
 			],
30
-		]);
30
+		] );
31 31
 	}
32 32
 
33 33
 	/**
@@ -35,12 +35,12 @@  discard block
 block discarded – undo
35 35
 	 */
36 36
 	protected function buildLinks()
37 37
 	{
38
-		$args = glsr( Style::class )->paginationArgs([
38
+		$args = glsr( Style::class )->paginationArgs( [
39 39
 			'current' => $this->args['paged'],
40 40
 			'total' => $this->args['total'],
41
-		]);
41
+		] );
42 42
 		if( is_front_page() ) {
43
-			unset( $args['format'] );
43
+			unset($args['format']);
44 44
 		}
45 45
 		if( $args['type'] == 'array' ) {
46 46
 			$args['type'] = 'plain';
@@ -56,6 +56,6 @@  discard block
 block discarded – undo
56 56
 		return wp_parse_args( $args, [
57 57
 			'paged' => glsr( QueryBuilder::class )->getPaged(),
58 58
 			'total' => 1,
59
-		]);
59
+		] );
60 60
 	}
61 61
 }
Please login to merge, or discard this patch.