Passed
Push — master ( 723a7a...81c350 )
by Paul
04:27
created
plugin/Modules/Html/Partials/SiteReviewsForm.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 				'submit_button' => $this->buildSubmitButton().$this->buildRecaptcha(),
58 58
 			],
59 59
 			'fields' => $this->getFields(),
60
-		]);
60
+		] );
61 61
 	}
62 62
 
63 63
 	/**
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 	{
68 68
 		$integration = glsr( OptionManager::class )->get( 'settings.submissions.recaptcha.integration' );
69 69
 		$recaptchaMethod = glsr( Helper::class )->buildMethodName( $integration, 'getRecaptcha' );
70
-		if( method_exists( $this, $recaptchaMethod )) {
70
+		if( method_exists( $this, $recaptchaMethod ) ) {
71 71
 			return $this->$recaptchaMethod();
72 72
 		}
73 73
 	}
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 		return glsr( Partial::class )->build( 'form-results', [
81 81
 			'errors' => $this->errors,
82 82
 			'message' => $this->message,
83
-		]);
83
+		] );
84 84
 	}
85 85
 
86 86
 	/**
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 	{
91 91
 		return glsr( Builder::class )->button( '<span></span>'.__( 'Submit your review', 'site-reviews' ), [
92 92
 			'type' => 'submit',
93
-		]);
93
+		] );
94 94
 	}
95 95
 
96 96
 	/**
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 		$fields = array_merge(
111 111
 			$this->getHiddenFields(),
112 112
 			[$this->getHoneypotField()],
113
-			$this->normalizeFields( glsr( Form::class )->getFields( 'submission-form' ))
113
+			$this->normalizeFields( glsr( Form::class )->getFields( 'submission-form' ) )
114 114
 		);
115 115
 		// glsr_debug( $fields );
116 116
 		return $fields;
@@ -124,30 +124,30 @@  discard block
 block discarded – undo
124 124
 		$fields = [[
125 125
 			'name' => 'action',
126 126
 			'value' => 'submit-review',
127
-		],[
127
+		], [
128 128
 			'name' => 'assign_to',
129 129
 			'value' => $this->args['assign_to'],
130
-		],[
130
+		], [
131 131
 			'name' => 'category',
132 132
 			'value' => $this->args['category'],
133
-		],[
133
+		], [
134 134
 			'name' => 'excluded',
135 135
 			'value' => $this->args['excluded'], // @todo should default to "[]"
136
-		],[
136
+		], [
137 137
 			'name' => 'form_id',
138 138
 			'value' => $this->args['id'],
139
-		],[
139
+		], [
140 140
 			'name' => 'nonce',
141 141
 			'value' => wp_create_nonce( 'submit-review' ),
142
-		],[
142
+		], [
143 143
 			'id' => 'recaptcha-token',
144 144
 			'name' => 'recaptcha-token',
145
-		],[
145
+		], [
146 146
 			'name' => 'referer',
147
-			'value' => wp_unslash( filter_input( INPUT_SERVER, 'REQUEST_URI' )),
147
+			'value' => wp_unslash( filter_input( INPUT_SERVER, 'REQUEST_URI' ) ),
148 148
 		]];
149 149
 		return array_map( function( $field ) {
150
-			return new Field( wp_parse_args( $field, ['type' => 'hidden'] ));
150
+			return new Field( wp_parse_args( $field, ['type' => 'hidden'] ) );
151 151
 		}, $fields );
152 152
 	}
153 153
 
@@ -156,10 +156,10 @@  discard block
 block discarded – undo
156 156
 	 */
157 157
 	protected function getHoneypotField()
158 158
 	{
159
-		return new Field([
159
+		return new Field( [
160 160
 			'name' => 'gotcha',
161 161
 			'type' => 'honeypot',
162
-		]);
162
+		] );
163 163
 	}
164 164
 
165 165
 	/**
@@ -167,12 +167,12 @@  discard block
 block discarded – undo
167 167
 	 */
168 168
 	protected function getRecaptchaCustom()
169 169
 	{
170
-		return glsr( Builder::class )->div([
170
+		return glsr( Builder::class )->div( [
171 171
 			'class' => 'glsr-recaptcha-holder',
172
-			'data-badge' => sanitize_text_field( glsr( OptionManager::class )->get( 'settings.submissions.recaptcha.position' )),
173
-			'data-sitekey' => sanitize_text_field( glsr( OptionManager::class )->get( 'settings.submissions.recaptcha.key' )),
172
+			'data-badge' => sanitize_text_field( glsr( OptionManager::class )->get( 'settings.submissions.recaptcha.position' ) ),
173
+			'data-sitekey' => sanitize_text_field( glsr( OptionManager::class )->get( 'settings.submissions.recaptcha.key' ) ),
174 174
 			'data-size' => 'invisible',
175
-		]);
175
+		] );
176 176
 	}
177 177
 
178 178
 	/**
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
 		$html = ob_get_clean();
186 186
 		return glsr( Builder::class )->div( $html, [
187 187
 			'class' => 'glsr-recaptcha-holder',
188
-		]);
188
+		] );
189 189
 	}
190 190
 
191 191
 	/**
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
 	 */
194 194
 	protected function normalizeFieldErrors( Field &$field )
195 195
 	{
196
-		if( !array_key_exists( $field->field['path'], $this->errors ))return;
196
+		if( !array_key_exists( $field->field['path'], $this->errors ) )return;
197 197
 		$field->field['errors'] = $this->errors[$field->field['path']];
198 198
 	}
199 199
 
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
 	 */
203 203
 	protected function normalizeFieldRequired( Field &$field )
204 204
 	{
205
-		if( !in_array( $field->field['path'], $this->required ))return;
205
+		if( !in_array( $field->field['path'], $this->required ) )return;
206 206
 		$field->field['required'] = true;
207 207
 	}
208 208
 
@@ -224,8 +224,8 @@  discard block
 block discarded – undo
224 224
 	 */
225 225
 	protected function normalizeFieldValue( Field &$field )
226 226
 	{
227
-		if( !array_key_exists( $field->field['path'], $this->values ))return;
228
-		if( in_array( $field->field['type'], ['radio', 'checkbox'] )) {
227
+		if( !array_key_exists( $field->field['path'], $this->values ) )return;
228
+		if( in_array( $field->field['type'], ['radio', 'checkbox'] ) ) {
229 229
 			$field->field['checked'] = $field->field['value'] == $this->values[$field->field['path']];
230 230
 		}
231 231
 		else {
Please login to merge, or discard this patch.
plugin/Database/QueryBuilder.php 2 patches
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -16,11 +16,11 @@  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 ) )continue;
20 20
 			$methodName = glsr( Helper::class )->buildMethodName( $key, __FUNCTION__ );
21
-			if( !method_exists( $this, $methodName ))continue;
21
+			if( !method_exists( $this, $methodName ) )continue;
22 22
 			$query = call_user_func( [$this, $methodName], $values[$key] );
23
-			if( is_array( $query )) {
23
+			if( is_array( $query ) ) {
24 24
 				$queries[] = $query;
25 25
 			}
26 26
 		}
@@ -35,11 +35,11 @@  discard block
 block discarded – undo
35 35
 	 */
36 36
 	public function buildSqlOr( $values, $sprintfFormat )
37 37
 	{
38
-		if( !is_array( $values )) {
38
+		if( !is_array( $values ) ) {
39 39
 			$values = explode( ',', $values );
40 40
 		}
41
-		$values = array_filter( array_map( 'trim', (array)$values ));
42
-		$values = array_map( function( $value ) use( $sprintfFormat ) {
41
+		$values = array_filter( array_map( 'trim', (array)$values ) );
42
+		$values = array_map( function( $value ) use($sprintfFormat) {
43 43
 			return sprintf( $sprintfFormat, $value );
44 44
 		}, $values );
45 45
 		return implode( ' OR ', $values );
@@ -54,11 +54,11 @@  discard block
 block discarded – undo
54 54
 	 */
55 55
 	public function filterSearchByTitle( $search, WP_Query $query )
56 56
 	{
57
-		if( empty( $search ) || empty( $query->get( 'search_terms' ))) {
57
+		if( empty($search) || empty($query->get( 'search_terms' )) ) {
58 58
 			return $search;
59 59
 		}
60 60
 		global $wpdb;
61
-		$n = empty( $query->get( 'exact' ))
61
+		$n = empty($query->get( 'exact' ))
62 62
 			? '%'
63 63
 			: '';
64 64
 		$search = [];
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 			? Application::PAGED_QUERY_VAR
83 83
 			: 'page';
84 84
 		return $isEnabled
85
-			? max( 1, intval( get_query_var( $pagedQuery )))
85
+			? max( 1, intval( get_query_var( $pagedQuery ) ) )
86 86
 			: 1;
87 87
 	}
88 88
 
@@ -92,11 +92,11 @@  discard block
 block discarded – undo
92 92
 	 */
93 93
 	protected function buildQueryAssignedTo( $value )
94 94
 	{
95
-		if( empty( $value ))return;
95
+		if( empty($value) )return;
96 96
 		return [
97 97
 			'compare' => 'IN',
98 98
 			'key' => 'assigned_to',
99
-			'value' => array_filter( array_map( 'trim', explode( ',', $value )), 'is_numeric' ),
99
+			'value' => array_filter( array_map( 'trim', explode( ',', $value ) ), 'is_numeric' ),
100 100
 		];
101 101
 	}
102 102
 
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
 	 */
107 107
 	protected function buildQueryCategory( $value )
108 108
 	{
109
-		if( empty( $value ))return;
109
+		if( empty($value) )return;
110 110
 		return [
111 111
 			'field' => 'term_id',
112 112
 			'taxonomy' => Application::TAXONOMY,
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 	 */
121 121
 	protected function buildQueryRating( $value )
122 122
 	{
123
-		if( !is_numeric( $value ) || !in_array( intval( $value ), range( 1, 5 )))return;
123
+		if( !is_numeric( $value ) || !in_array( intval( $value ), range( 1, 5 ) ) )return;
124 124
 		return [
125 125
 			'compare' => '>=',
126 126
 			'key' => 'rating',
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 	 */
135 135
 	protected function buildQueryType( $value )
136 136
 	{
137
-		if( in_array( $value, ['','all'] ))return;
137
+		if( in_array( $value, ['', 'all'] ) )return;
138 138
 		return [
139 139
 			'key' => 'review_type',
140 140
 			'value' => $value,
Please login to merge, or discard this 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, __FUNCTION__ );
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;
@@ -92,7 +96,9 @@  discard block
 block discarded – undo
92 96
 	 */
93 97
 	protected function buildQueryAssignedTo( $value )
94 98
 	{
95
-		if( empty( $value ))return;
99
+		if( empty( $value )) {
100
+			return;
101
+		}
96 102
 		return [
97 103
 			'compare' => 'IN',
98 104
 			'key' => 'assigned_to',
@@ -106,7 +112,9 @@  discard block
 block discarded – undo
106 112
 	 */
107 113
 	protected function buildQueryCategory( $value )
108 114
 	{
109
-		if( empty( $value ))return;
115
+		if( empty( $value )) {
116
+			return;
117
+		}
110 118
 		return [
111 119
 			'field' => 'term_id',
112 120
 			'taxonomy' => Application::TAXONOMY,
@@ -120,7 +128,9 @@  discard block
 block discarded – undo
120 128
 	 */
121 129
 	protected function buildQueryRating( $value )
122 130
 	{
123
-		if( !is_numeric( $value ) || !in_array( intval( $value ), range( 1, 5 )))return;
131
+		if( !is_numeric( $value ) || !in_array( intval( $value ), range( 1, 5 ))) {
132
+			return;
133
+		}
124 134
 		return [
125 135
 			'compare' => '>=',
126 136
 			'key' => 'rating',
@@ -134,7 +144,9 @@  discard block
 block discarded – undo
134 144
 	 */
135 145
 	protected function buildQueryType( $value )
136 146
 	{
137
-		if( in_array( $value, ['','all'] ))return;
147
+		if( in_array( $value, ['','all'] )) {
148
+			return;
149
+		}
138 150
 		return [
139 151
 			'key' => 'review_type',
140 152
 			'value' => $value,
Please login to merge, or discard this patch.