Passed
Push — master ( fbb7de...43cb65 )
by Paul
25:46 queued 14:45
created
plugin/Modules/Validator/ValidationRules.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 		if( strpos( $message, '%s' ) === false ) {
29 29
 			return $message;
30 30
 		}
31
-		return preg_replace_callback( '/(%s)/', function() use( &$parameters ) {
31
+		return preg_replace_callback( '/(%s)/', function() use(&$parameters) {
32 32
 			foreach( $parameters as $key => $value ) {
33 33
 				return array_shift( $parameters );
34 34
 			}
@@ -113,8 +113,8 @@  discard block
 block discarded – undo
113 113
 	public function validateRequired( $value )
114 114
 	{
115 115
 		return is_null( $value )
116
-			|| ( is_string( $value ) && trim( $value ) === '' )
117
-			|| ( is_array( $value ) && count( $value ) < 1 )
116
+			|| (is_string( $value ) && trim( $value ) === '')
117
+			|| (is_array( $value ) && count( $value ) < 1)
118 118
 			? false
119 119
 			: true;
120 120
 	}
Please login to merge, or discard this patch.
site-reviews.php 2 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,9 @@
 block discarded – undo
21 21
 if( !class_exists( 'GL_Plugin_Check_v3' )) {
22 22
 	require_once __DIR__.'/activate.php';
23 23
 }
24
-if( !(new GL_Plugin_Check_v3( __FILE__ ))->canProceed() )return;
24
+if( !(new GL_Plugin_Check_v3( __FILE__ ))->canProceed() ) {
25
+	return;
26
+}
25 27
 require_once __DIR__.'/autoload.php';
26 28
 require_once __DIR__.'/compatibility.php';
27 29
 require_once __DIR__.'/deprecated.php';
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 
19 19
 defined( 'WPINC' ) || die;
20 20
 
21
-if( !class_exists( 'GL_Plugin_Check_v3' )) {
21
+if( !class_exists( 'GL_Plugin_Check_v3' ) ) {
22 22
 	require_once __DIR__.'/activate.php';
23 23
 }
24 24
 if( !(new GL_Plugin_Check_v3( __FILE__ ))->canProceed() )return;
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 
30 30
 $app = new GeminiLabs\SiteReviews\Application;
31 31
 $app->make( 'Provider' )->register( $app );
32
-register_activation_hook( __FILE__, array( $app, 'activate' ));
33
-register_deactivation_hook( __FILE__, array( $app, 'deactivate' ));
34
-register_shutdown_function( array( $app, 'catchFatalError' ));
32
+register_activation_hook( __FILE__, array( $app, 'activate' ) );
33
+register_deactivation_hook( __FILE__, array( $app, 'deactivate' ) );
34
+register_shutdown_function( array( $app, 'catchFatalError' ) );
35 35
 $app->init();
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/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/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.
plugin/Handlers/CreateReview.php 2 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -22,7 +22,9 @@
 block discarded – undo
22 22
 		}
23 23
 		glsr( Session::class )->set( $command->form_id.'message', __( 'Your review has been submitted!', 'site-reviews' ));
24 24
 		glsr( Notification::class )->send( $review );
25
-		if( $command->ajax_request )return;
25
+		if( $command->ajax_request ) {
26
+			return;
27
+		}
26 28
 		wp_safe_redirect( $this->getReferer( $command ));
27 29
 		exit;
28 30
 	}
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -17,13 +17,13 @@  discard block
 block discarded – undo
17 17
 		$review = glsr( ReviewManager::class )->create( $command );
18 18
 		if( !$review ) {
19 19
 			glsr( Session::class )->set( $command->form_id.'errors', [] );
20
-			glsr( Session::class )->set( $command->form_id.'message', __( 'Your review could not be submitted and the error has been logged. Please notify the site admin.', 'site-reviews' ));
20
+			glsr( Session::class )->set( $command->form_id.'message', __( 'Your review could not be submitted and the error has been logged. Please notify the site admin.', 'site-reviews' ) );
21 21
 			return;
22 22
 		}
23
-		glsr( Session::class )->set( $command->form_id.'message', __( 'Your review has been submitted!', 'site-reviews' ));
23
+		glsr( Session::class )->set( $command->form_id.'message', __( 'Your review has been submitted!', 'site-reviews' ) );
24 24
 		glsr( Notification::class )->send( $review );
25 25
 		if( $command->ajax_request )return;
26
-		wp_safe_redirect( $this->getReferer( $command ));
26
+		wp_safe_redirect( $this->getReferer( $command ) );
27 27
 		exit;
28 28
 	}
29 29
 
@@ -32,12 +32,12 @@  discard block
 block discarded – undo
32 32
 	 */
33 33
 	protected function getReferer( Command $command )
34 34
 	{
35
-		$referer = trim( strval( get_post_meta( $command->post_id, 'redirect_to', true )));
35
+		$referer = trim( strval( get_post_meta( $command->post_id, 'redirect_to', true ) ) );
36 36
 		$referer = apply_filters( 'site-reviews/review/redirect', $referer, $command );
37
-		if( empty( $referer )) {
37
+		if( empty($referer) ) {
38 38
 			$referer = $command->referer;
39 39
 		}
40
-		if( empty( $referer )) {
40
+		if( empty($referer) ) {
41 41
 			glsr_log()->warning( 'The form referer ($_SERVER[REQUEST_URI]) was empty.' )->info( $command );
42 42
 			$referer = home_url();
43 43
 		}
Please login to merge, or discard this patch.
plugin/Modules/Html/Form.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@
 block discarded – undo
28 28
 	{
29 29
 		$fields = [];
30 30
 		foreach( glsr()->config( 'forms/'.$id ) as $name => $field ) {
31
-			$fields[] = new Field( wp_parse_args( $field, ['name' => $name] ));
31
+			$fields[] = new Field( wp_parse_args( $field, ['name' => $name] ) );
32 32
 		}
33 33
 		return $fields;
34 34
 	}
Please login to merge, or discard this patch.