Test Failed
Push — master ( a95317...fac2f0 )
by Paul
03:50
created
plugin/Container.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 	 */
38 38
 	public static function load()
39 39
 	{
40
-		if( empty( static::$instance )) {
40
+		if( empty(static::$instance) ) {
41 41
 			static::$instance = new static;
42 42
 		}
43 43
 		return static::$instance;
@@ -49,14 +49,14 @@  discard block
 block discarded – undo
49 49
 	 */
50 50
 	public function __get( $property )
51 51
 	{
52
-		if( property_exists( $this, $property ) && !in_array( $property, static::PROTECTED_PROPERTIES )) {
52
+		if( property_exists( $this, $property ) && !in_array( $property, static::PROTECTED_PROPERTIES ) ) {
53 53
 			return $this->$property;
54 54
 		}
55
-		$constant = 'static::'.strtoupper( $this->make( Helper::class )->snakeCase( $property ));
56
-		if( defined( $constant )) {
55
+		$constant = 'static::'.strtoupper( $this->make( Helper::class )->snakeCase( $property ) );
56
+		if( defined( $constant ) ) {
57 57
 			return constant( $constant );
58 58
 		}
59
-		return isset( $this->storage[$property] )
59
+		return isset($this->storage[$property])
60 60
 			? $this->storage[$property]
61 61
 			: null;
62 62
 	}
@@ -68,14 +68,14 @@  discard block
 block discarded – undo
68 68
 	 */
69 69
 	public function __set( $property, $value )
70 70
 	{
71
-		if( !property_exists( $this, $property ) || in_array( $property, static::PROTECTED_PROPERTIES )) {
71
+		if( !property_exists( $this, $property ) || in_array( $property, static::PROTECTED_PROPERTIES ) ) {
72 72
 			$this->storage[$property] = $value;
73 73
 		}
74
-		else if( !isset( $this->$property )) {
74
+		else if( !isset($this->$property) ) {
75 75
 			$this->$property = $value;
76 76
 		}
77 77
 		else {
78
-			throw new Exception( sprintf( 'The "%s" property cannot be changed once set.', $property ));
78
+			throw new Exception( sprintf( 'The "%s" property cannot be changed once set.', $property ) );
79 79
 		}
80 80
 	}
81 81
 
@@ -97,16 +97,16 @@  discard block
 block discarded – undo
97 97
 	 */
98 98
 	public function make( $abstract )
99 99
 	{
100
-		if( !isset( $this->services[$abstract] )) {
100
+		if( !isset($this->services[$abstract]) ) {
101 101
 			$abstract = $this->addNamespace( $abstract );
102 102
 		}
103
-		if( isset( $this->services[$abstract] )) {
103
+		if( isset($this->services[$abstract]) ) {
104 104
 			$abstract = $this->services[$abstract];
105 105
 		}
106
-		if( is_callable( $abstract )) {
106
+		if( is_callable( $abstract ) ) {
107 107
 			return call_user_func_array( $abstract, [$this] );
108 108
 		}
109
-		if( is_object( $abstract )) {
109
+		if( is_object( $abstract ) ) {
110 110
 			return $abstract;
111 111
 		}
112 112
 		return $this->resolve( $abstract );
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 	 */
121 121
 	public function singleton( $alias, $binding )
122 122
 	{
123
-		$this->bind( $alias, $this->make( $binding ));
123
+		$this->bind( $alias, $this->make( $binding ) );
124 124
 	}
125 125
 
126 126
 	/**
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
 	 */
131 131
 	protected function addNamespace( $abstract )
132 132
 	{
133
-		if( strpos( $abstract, __NAMESPACE__ ) === false && !class_exists( $abstract )) {
133
+		if( strpos( $abstract, __NAMESPACE__ ) === false && !class_exists( $abstract ) ) {
134 134
 			$abstract = __NAMESPACE__.'\\'.$abstract;
135 135
 		}
136 136
 		return $abstract;
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
 			throw new Exception( 'Target ['.$concrete.'] is not instantiable.' );
153 153
 		}
154 154
 		$constructor = $reflector->getConstructor();
155
-		if( empty( $constructor )) {
155
+		if( empty($constructor) ) {
156 156
 			return new $concrete;
157 157
 		}
158 158
 		return $reflector->newInstanceArgs(
Please login to merge, or discard this patch.
plugin/Modules/Html.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -82,7 +82,7 @@
 block discarded – undo
82 82
 	{
83 83
 		$this->render()->div( glsr( Notice::class )->get(), [
84 84
 			'id' => 'glsr-notices',
85
-		]);
85
+		] );
86 86
 	}
87 87
 
88 88
 	/**
Please login to merge, or discard this patch.
plugin/Modules/Validator/ValidationRules.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -130,8 +130,8 @@
 block discarded – undo
130 130
 	public function validateRequired( $attribute, $value )
131 131
 	{
132 132
 		return is_null( $value )
133
-			|| ( is_string( $value ) && trim( $value ) === '' )
134
-			|| ( is_array( $value ) && count( $value ) < 1 )
133
+			|| (is_string( $value ) && trim( $value ) === '')
134
+			|| (is_array( $value ) && count( $value ) < 1)
135 135
 			? false
136 136
 			: true;
137 137
 	}
Please login to merge, or discard this patch.
plugin/Modules/Email.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 		$this->message = $this->buildHtmlMessage( $email );
44 44
 		$this->subject = $email['subject'];
45 45
 		$this->to = $email['to'];
46
-		add_action( 'phpmailer_init', [ $this, 'buildPlainTextMessage'] );
46
+		add_action( 'phpmailer_init', [$this, 'buildPlainTextMessage'] );
47 47
 		return $this;
48 48
 	}
49 49
 
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 	 */
84 84
 	public function buildPlainTextMessage( $phpmailer )
85 85
 	{
86
-		if( $phpmailer->ContentType === 'text/plain' || !empty( $phpmailer->AltBody ))return;
86
+		if( $phpmailer->ContentType === 'text/plain' || !empty($phpmailer->AltBody) )return;
87 87
 		$message = $this->stripHtmlTags( $phpmailer->Body );
88 88
 		$phpmailer->AltBody = apply_filters( 'site-reviews/email/message', $message, 'text', $this );
89 89
 	}
@@ -99,10 +99,10 @@  discard block
 block discarded – undo
99 99
 			'from',
100 100
 			'reply-to',
101 101
 		];
102
-		$headers = array_intersect_key( $email, array_flip( $allowed ));
102
+		$headers = array_intersect_key( $email, array_flip( $allowed ) );
103 103
 		$headers = array_filter( $headers );
104 104
 		foreach( $headers as $key => $value ) {
105
-			unset( $headers[ $key ] );
105
+			unset($headers[$key]);
106 106
 			$headers[] = "{$key}: {$value}";
107 107
 		}
108 108
 		$headers[] = 'Content-Type: text/html';
@@ -114,16 +114,16 @@  discard block
 block discarded – undo
114 114
 	 */
115 115
 	protected function buildHtmlMessage( $email )
116 116
 	{
117
-		$template = trim( glsr( OptionManager::class )->get( 'settings.general.notification_message' ));
118
-		if( !empty( $template )) {
117
+		$template = trim( glsr( OptionManager::class )->get( 'settings.general.notification_message' ) );
118
+		if( !empty($template) ) {
119 119
 			$message = glsr( Template::class )->interpolate( $template, $email['template-tags'] );
120 120
 		}
121 121
 		else if( $email['template'] ) {
122 122
 			$message = glsr( Template::class )->build( 'templates/'.$email['template'], [
123 123
 				'context' => $email['template-tags'],
124
-			]);
124
+			] );
125 125
 		}
126
-		if( !isset( $message )) {
126
+		if( !isset($message) ) {
127 127
 			$message = $email['message'];
128 128
 		}
129 129
 		$message = $email['before'].$message.$email['after'];
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 		$message = str_replace( ']]>', ']]&gt;', $message );
135 135
 		$message = glsr( Template::class )->build( 'email/index', [
136 136
 			'context' => ['message' => $message],
137
-		]);
137
+		] );
138 138
 		return apply_filters( 'site-reviews/email/message', stripslashes( $message ), 'html', $this );
139 139
 	}
140 140
 
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
 			'to' => '',
161 161
 		];
162 162
 		$email = shortcode_atts( $defaults, $email );
163
-		if( empty( $email['reply-to'] )) {
163
+		if( empty($email['reply-to']) ) {
164 164
 			$email['reply-to'] = $email['from'];
165 165
 		}
166 166
 		return apply_filters( 'site-reviews/email/compose', $email, $this );
Please login to merge, or discard this patch.
plugin/Modules/Notice.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -15,10 +15,10 @@  discard block
 block discarded – undo
15 15
 	 */
16 16
 	public function add( $type, $message, array $args = [] )
17 17
 	{
18
-		if( empty( array_filter( [$message, $type] )))return;
18
+		if( empty(array_filter( [$message, $type] )) )return;
19 19
 		$args['message'] = $message;
20 20
 		$args['type'] = $type;
21
-		add_settings_error( Application::ID, '', json_encode( $this->normalize( $args )));
21
+		add_settings_error( Application::ID, '', json_encode( $this->normalize( $args ) ) );
22 22
 	}
23 23
 
24 24
 	/**
@@ -54,11 +54,11 @@  discard block
 block discarded – undo
54 54
 	public function get()
55 55
 	{
56 56
 		$notices = array_map( 'unserialize',
57
-			array_unique( array_map( 'serialize', get_settings_errors( Application::ID )))
57
+			array_unique( array_map( 'serialize', get_settings_errors( Application::ID ) ) )
58 58
 		);
59
-		if( empty( $notices ))return;
59
+		if( empty($notices) )return;
60 60
 		return array_reduce( $notices, function( $carry, $notice ) {
61
-			return $carry.$this->buildNotice( json_decode( $notice['message'], true ));
61
+			return $carry.$this->buildNotice( json_decode( $notice['message'], true ) );
62 62
 		});
63 63
 	}
64 64
 
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 		}
80 80
 		return glsr( Builder::class )->div( $messages, [
81 81
 			'class' => $class,
82
-		]);
82
+		] );
83 83
 	}
84 84
 
85 85
 	/**
@@ -94,13 +94,13 @@  discard block
 block discarded – undo
94 94
 			'type' => '',
95 95
 		];
96 96
 		$args = shortcode_atts( $defaults, $args );
97
-		if( !in_array( $args['type'], ['error', 'warning', 'success'] )) {
97
+		if( !in_array( $args['type'], ['error', 'warning', 'success'] ) ) {
98 98
 			$args['type'] = 'success';
99 99
 		}
100 100
 		$args['messages'] = is_wp_error( $args['message'] )
101 101
 			? (array)$args['message']->get_error_message()
102 102
 			: (array)$args['message'];
103
-		unset( $args['message'] );
103
+		unset($args['message']);
104 104
 		return $args;
105 105
 	}
106 106
 }
Please login to merge, or discard this patch.
plugin/Modules/Html/Fields/Honeypot.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@
 block discarded – undo
17 17
 			'style' => 'display:none!important',
18 18
 			'tabindex' => '-1',
19 19
 			'type' => 'text',
20
-		]);
20
+		] );
21 21
 		$this->builder->tag = 'input';
22 22
 		return $this->builder->getOpeningTag();
23 23
 	}
Please login to merge, or discard this patch.
plugin/Modules/Html/Fields/YesNo.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@
 block discarded – undo
17 17
 				'no' => __( 'No', 'site-reviews' ),
18 18
 				'yes' => __( 'Yes', 'site-reviews' ),
19 19
 			],
20
-		]);
20
+		] );
21 21
 		$this->builder->tag = 'input';
22 22
 		return $this->builder->buildFormInput();
23 23
 	}
Please login to merge, or discard this patch.
plugin/Modules/Html/Builder.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 	{
66 66
 		$instance = new static();
67 67
 		$instance->setTagFromMethod( $method );
68
-		call_user_func_array( [$instance, 'normalize'], $args += ['',''] );
68
+		call_user_func_array( [$instance, 'normalize'], $args += ['', ''] );
69 69
 		$tags = array_merge( static::TAGS_FORM, static::TAGS_STRUCTURE, static::TAGS_TEXT );
70 70
 		$generatedTag = in_array( $instance->tag, $tags )
71 71
 			? $instance->buildTag()
@@ -89,8 +89,8 @@  discard block
 block discarded – undo
89 89
 			'render' => 'is_bool',
90 90
 			'tag' => 'is_string',
91 91
 		];
92
-		if( !isset( $properties[$property] )
93
-			|| empty( array_filter( [$value], $properties[$property] ))
92
+		if( !isset($properties[$property])
93
+			|| empty(array_filter( [$value], $properties[$property] ))
94 94
 		)return;
95 95
 		$this->$property = $value;
96 96
 	}
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 	 */
109 109
 	public function getOpeningTag()
110 110
 	{
111
-		$attributes = glsr( Attributes::class )->{$this->tag}( $this->args )->toString();
111
+		$attributes = glsr( Attributes::class )->{$this->tag}($this->args)->toString();
112 112
 		return '<'.trim( $this->tag.' '.$attributes ).'>';
113 113
 	}
114 114
 
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
 	protected function buildCustomField()
119 119
 	{
120 120
 		$className = glsr( Helper::class )->buildClassName( $this->tag, __NAMESPACE__.'\Fields' );
121
-		if( !class_exists( $className )) {
121
+		if( !class_exists( $className ) ) {
122 122
 			glsr_log()->error( 'Field missing: '.$className );
123 123
 			return;
124 124
 		}
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
 	 */
131 131
 	protected function buildDefaultTag( $text = '' )
132 132
 	{
133
-		if( empty( $text )) {
133
+		if( empty($text) ) {
134 134
 			$text = $this->args['text'];
135 135
 		}
136 136
 		return $this->getOpeningTag().$text.$this->getClosingTag();
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 	 */
142 142
 	protected function buildFieldDescription()
143 143
 	{
144
-		if( !empty( $this->args['description'] )) {
144
+		if( !empty($this->args['description']) ) {
145 145
 			return $this->small( $this->args['description'] );
146 146
 		}
147 147
 	}
@@ -151,10 +151,10 @@  discard block
 block discarded – undo
151 151
 	 */
152 152
 	protected function buildFormInput()
153 153
 	{
154
-		if( !in_array( $this->args['type'], ['checkbox', 'radio'] )) {
154
+		if( !in_array( $this->args['type'], ['checkbox', 'radio'] ) ) {
155 155
 			return $this->buildFormLabel().$this->getOpeningTag();
156 156
 		}
157
-		return empty( $this->args['options'] )
157
+		return empty($this->args['options'])
158 158
 			? $this->buildFormInputChoice()
159 159
 			: $this->buildFormInputMultiChoice();
160 160
 	}
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
 				'name' => $this->args['name'].'[]',
179 179
 				'text' => $this->args['options'][$key],
180 180
 				'value' => $key,
181
-			]));
181
+			]) );
182 182
 		});
183 183
 		return $this->ul( $options );
184 184
 	}
@@ -188,11 +188,11 @@  discard block
 block discarded – undo
188 188
 	 */
189 189
 	protected function buildFormLabel()
190 190
 	{
191
-		if( empty( $this->args['label'] ) || $this->args['type'] == 'hidden' )return;
192
-		return $this->label([
191
+		if( empty($this->args['label']) || $this->args['type'] == 'hidden' )return;
192
+		return $this->label( [
193 193
 			'for' => $this->args['id'],
194 194
 			'text' => $this->args['label'],
195
-		]);
195
+		] );
196 196
 	}
197 197
 
198 198
 	/**
@@ -209,11 +209,11 @@  discard block
 block discarded – undo
209 209
 	protected function buildFormSelectOptions()
210 210
 	{
211 211
 		return array_reduce( array_keys( $this->args['options'] ), function( $carry, $key ) {
212
-			return $carry.$this->option([
212
+			return $carry.$this->option( [
213 213
 				'selected' => $this->args['value'] == $key,
214 214
 				'text' => $this->args['options'][$key],
215 215
 				'value' => $key,
216
-			]);
216
+			] );
217 217
 		});
218 218
 	}
219 219
 
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
 	 */
231 231
 	protected function buildTag()
232 232
 	{
233
-		if( !in_array( $this->tag, static::TAGS_FORM )) {
233
+		if( !in_array( $this->tag, static::TAGS_FORM ) ) {
234 234
 			return $this->buildDefaultTag();
235 235
 		}
236 236
 		return call_user_func( [$this, 'buildForm'.ucfirst( $this->tag )] ).$this->buildFieldDescription();
@@ -242,13 +242,13 @@  discard block
 block discarded – undo
242 242
 	 */
243 243
 	protected function normalize( ...$params )
244 244
 	{
245
-		if( is_string( $params[0] ) || is_numeric( $params[0] )) {
245
+		if( is_string( $params[0] ) || is_numeric( $params[0] ) ) {
246 246
 			$this->setNameOrTextAttributeForTag( $params[0] );
247 247
 		}
248
-		if( is_array( $params[0] )) {
248
+		if( is_array( $params[0] ) ) {
249 249
 			$this->args += $params[0];
250 250
 		}
251
-		else if( is_array( $params[1] )) {
251
+		else if( is_array( $params[1] ) ) {
252 252
 			$this->args += $params[1];
253 253
 		}
254 254
 		$this->args = glsr( BuilderDefaults::class )->merge( $this->args );
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
 	protected function setTagFromMethod( $method )
274 274
 	{
275 275
 		$this->tag = strtolower( $method );
276
-		if( in_array( $this->tag, static::INPUT_TYPES )) {
276
+		if( in_array( $this->tag, static::INPUT_TYPES ) ) {
277 277
 			$this->args['type'] = $this->tag;
278 278
 			$this->tag = 'input';
279 279
 		}
Please login to merge, or discard this patch.
plugin/Modules/Html/Partials/SiteReviewsForm.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -14,14 +14,14 @@
 block discarded – undo
14 14
 	{
15 15
 		$partial = glsr( Html::class )->buildTemplate( 'templates/reviews-form', [
16 16
 			'globals' => $args,
17
-		]);
17
+		] );
18 18
 		$form = glsr( Builder::class )->form( $partial, [
19 19
 			'class' => 'glsr-form',
20 20
 			'id' => $args['id'],
21 21
 			'method' => 'post',
22
-		]);
22
+		] );
23 23
 		return glsr( Builder::class )->div( $form, [
24 24
 			'class' => 'glsr-form-wrap '.$args['class'],
25
-		]);
25
+		] );
26 26
 	}
27 27
 }
Please login to merge, or discard this patch.