Passed
Push — master ( 8a0962...507d84 )
by Paul
03:52
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/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/Partial.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
13 13
 	public function build( $partialPath, array $args = [] )
14 14
 	{
15 15
 		$className = glsr( Helper::class )->buildClassName( $partialPath, 'Modules\Html\Partials' );
16
-		if( !class_exists( $className )) {
16
+		if( !class_exists( $className ) ) {
17 17
 			glsr_log()->error( 'Partial missing: '.$className );
18 18
 			return;
19 19
 		}
Please login to merge, or discard this patch.
plugin/Modules/Akismet.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -31,10 +31,10 @@  discard block
 block discarded – undo
31 31
 			// 'is_test' => 1,
32 32
 		];
33 33
 		foreach( $_SERVER as $key => $value ) {
34
-			if( is_array( $value ) || in_array( $key, ['HTTP_COOKIE', 'HTTP_COOKIE2', 'PHP_AUTH_PW'] ))continue;
34
+			if( is_array( $value ) || in_array( $key, ['HTTP_COOKIE', 'HTTP_COOKIE2', 'PHP_AUTH_PW'] ) )continue;
35 35
 			$submission[$key] = $value;
36 36
 		}
37
-		return $this->check( apply_filters( 'site-reviews/akismet/submission', $submission, $review ));
37
+		return $this->check( apply_filters( 'site-reviews/akismet/submission', $submission, $review ) );
38 38
 	}
39 39
 
40 40
 	/**
@@ -57,12 +57,12 @@  discard block
 block discarded – undo
57 57
 	{
58 58
 		$query = [];
59 59
 		foreach( $data as $key => $value ) {
60
-			if( is_array( $value ) || is_object( $value ))continue;
60
+			if( is_array( $value ) || is_object( $value ) )continue;
61 61
 			if( $value === false ) {
62 62
 				$value = '0';
63 63
 			}
64 64
 			$value = trim( $value );
65
-			if( !strlen( $value ))continue;
65
+			if( !strlen( $value ) )continue;
66 66
 			$query[] = urlencode( $key ).'='.urlencode( $value );
67 67
 		}
68 68
 		return implode( '&', $query );
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 			|| !is_callable( ['Akismet', 'get_api_key'] )
78 78
 			|| !is_callable( ['Akismet', 'http_post'] )
79 79
 			? false
80
-			: (bool) AkismetPlugin::get_api_key();
80
+			: (bool)AkismetPlugin::get_api_key();
81 81
 		return apply_filters( 'site-reviews/akismet/is-active', $check );
82 82
 	}
83 83
 }
Please login to merge, or discard this patch.
plugin/Commands/TogglePinned.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@
 block discarded – undo
10 10
 	public function __construct( $input )
11 11
 	{
12 12
 		$this->id = $input['id'];
13
-		$this->pinned = isset( $input['pinned'] )
13
+		$this->pinned = isset($input['pinned'])
14 14
 			? wp_validate_boolean( $input['pinned'] )
15 15
 			: null;
16 16
 	}
Please login to merge, or discard this patch.
plugin/Defaults/CreateReviewDefaults.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@
 block discarded – undo
16 16
 			'author' => '',
17 17
 			'avatar' => '',
18 18
 			'content' => '',
19
-			'date' => get_date_from_gmt( gmdate( 'Y-m-d H:i:s' )),
19
+			'date' => get_date_from_gmt( gmdate( 'Y-m-d H:i:s' ) ),
20 20
 			'email' => '',
21 21
 			'ip_address' => '',
22 22
 			'pinned' => false,
Please login to merge, or discard this patch.
plugin/Shortcodes/ButtonGenerator.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 			'label' => '['.$tag.']',
48 48
 			'required' => $this->required,
49 49
 			'title' => esc_html__( 'Shortcode', 'site-reviews' ),
50
-		]);
50
+		] );
51 51
 		return $this;
52 52
 	}
53 53
 
@@ -57,12 +57,12 @@  discard block
 block discarded – undo
57 57
 	protected function generateFields( array $fields )
58 58
 	{
59 59
 		$generatedFields = array_map( function( $field ) {
60
-			if( empty( $field ))return;
60
+			if( empty($field) )return;
61 61
 			$field = $this->normalize( $field );
62
-			if( !method_exists( $this, $method = 'normalize'.ucfirst( $field['type'] )))return;
62
+			if( !method_exists( $this, $method = 'normalize'.ucfirst( $field['type'] ) ) )return;
63 63
 			return $this->$method( $field );
64 64
 		}, $fields );
65
-		return array_values( array_filter( $generatedFields ));
65
+		return array_values( array_filter( $generatedFields ) );
66 66
 	}
67 67
 
68 68
 	/**
@@ -71,15 +71,15 @@  discard block
 block discarded – undo
71 71
 	protected function getFields()
72 72
 	{
73 73
 		$fields = $this->generateFields( $this->fields() );
74
-		if( !empty( $this->errors )) {
74
+		if( !empty($this->errors) ) {
75 75
 			$errors = [];
76 76
 			foreach( $this->required as $name => $alert ) {
77
-				if( false !== array_search( $name, array_column( $fields, 'name' )))continue;
77
+				if( false !== array_search( $name, array_column( $fields, 'name' ) ) )continue;
78 78
 				$errors[] = $this->errors[$name];
79 79
 			}
80 80
 			$this->errors = $errors;
81 81
 		}
82
-		return empty( $this->errors )
82
+		return empty($this->errors)
83 83
 			? $fields
84 84
 			: $this->errors;
85 85
 	}
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 		return wp_parse_args( $field, [
93 93
 			'items' => [],
94 94
 			'type' => '',
95
-		]);
95
+		] );
96 96
 	}
97 97
 
98 98
 	/**
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 			'tooltip' => '',
111 111
 			'type' => '',
112 112
 			'value' => '',
113
-		]);
113
+		] );
114 114
 	}
115 115
 
116 116
 	/**
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
 	 */
119 119
 	protected function normalizeContainer( array $field )
120 120
 	{
121
-		if( !array_key_exists( 'html', $field ) && !array_key_exists( 'items', $field ))return;
121
+		if( !array_key_exists( 'html', $field ) && !array_key_exists( 'items', $field ) )return;
122 122
 		$field['items'] = $this->generateFields( $field['items'] );
123 123
 		return $field;
124 124
 	}
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 	 */
129 129
 	protected function normalizeField( array $field, array $defaults )
130 130
 	{
131
-		if( !$this->validate( $field ))return;
131
+		if( !$this->validate( $field ) )return;
132 132
 		return array_filter( shortcode_atts( $defaults, $field ), function( $value ) {
133 133
 			return $value !== '';
134 134
 		});
@@ -148,9 +148,9 @@  discard block
 block discarded – undo
148 148
 			'tooltip' => '',
149 149
 			'type' => '',
150 150
 			'value' => '',
151
-		]);
152
-		if( !is_array( $listbox ))return;
153
-		if( !array_key_exists( '', $listbox['options'] )) {
151
+		] );
152
+		if( !is_array( $listbox ) )return;
153
+		if( !array_key_exists( '', $listbox['options'] ) ) {
154 154
 			$listbox['options'] = ['' => $listbox['placeholder']] + $listbox['options'];
155 155
 		}
156 156
 		foreach( $listbox['options'] as $value => $text ) {
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 	 */
168 168
 	protected function normalizePost( array $field )
169 169
 	{
170
-		if( !is_array( $field['query_args'] )) {
170
+		if( !is_array( $field['query_args'] ) ) {
171 171
 			$field['query_args'] = [];
172 172
 		}
173 173
 		$posts = get_posts( wp_parse_args( $field['query_args'], [
@@ -175,8 +175,8 @@  discard block
 block discarded – undo
175 175
 			'orderby' => 'title',
176 176
 			'post_type' => 'post',
177 177
 			'posts_per_page' => 30,
178
-		]));
179
-		if( !empty( $posts )) {
178
+		] ) );
179
+		if( !empty($posts) ) {
180 180
 			$options = [];
181 181
 			foreach( $posts as $post ) {
182 182
 				$options[$post->ID] = esc_html( $post->post_title );
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
 			'tooltip' => '',
207 207
 			'type' => '',
208 208
 			'value' => '',
209
-		]);
209
+		] );
210 210
 	}
211 211
 
212 212
 	/**
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
 	 */
215 215
 	protected function validate( array $field )
216 216
 	{
217
-		$args = shortcode_atts([
217
+		$args = shortcode_atts( [
218 218
 			'label' => '',
219 219
 			'name' => false,
220 220
 			'required' => false,
@@ -230,13 +230,13 @@  discard block
 block discarded – undo
230 230
 	 */
231 231
 	protected function validateErrors( array $args )
232 232
 	{
233
-		if( !isset( $args['required']['error'] )) {
233
+		if( !isset($args['required']['error']) ) {
234 234
 			return true;
235 235
 		}
236
-		$this->errors[$args['name']] = $this->normalizeContainer([
236
+		$this->errors[$args['name']] = $this->normalizeContainer( [
237 237
 			'html' => $args['required']['error'],
238 238
 			'type' => 'container',
239
-		]);
239
+		] );
240 240
 		return false;
241 241
 	}
242 242
 
@@ -249,10 +249,10 @@  discard block
 block discarded – undo
249 249
 			return true;
250 250
 		}
251 251
 		$alert = esc_html__( 'Some of the shortcode options are required.', 'site-reviews' );
252
-		if( isset( $args['required']['alert'] )) {
252
+		if( isset($args['required']['alert']) ) {
253 253
 			$alert = $args['required']['alert'];
254 254
 		}
255
-		else if( !empty( $args['label'] )) {
255
+		else if( !empty($args['label']) ) {
256 256
 			$alert = sprintf(
257 257
 				esc_html_x( 'The "%s" option is required.', 'the option label', 'site-reviews' ),
258 258
 				str_replace( ':', '', $args['label'] )
Please login to merge, or discard this patch.
plugin/Modules/Date.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@
 block discarded – undo
31 31
 		$diff = time() - strtotime( $date );
32 32
 		foreach( static::$TIME_PERIODS as $i => $timePeriod ) {
33 33
 			if( $diff > $timePeriod[0] )continue;
34
-			$unit = intval( floor( $diff / $timePeriod[1] ));
34
+			$unit = intval( floor( $diff / $timePeriod[1] ) );
35 35
 			$relativeDates = [
36 36
 				_n( '%s second ago', '%s seconds ago', $unit, 'site-reviews' ),
37 37
 				_n( '%s minute ago', '%s minutes ago', $unit, 'site-reviews' ),
Please login to merge, or discard this patch.