Passed
Push — develop ( dd0ca7...d8277b )
by Paul
02:50
created
src/Controller.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
 	 */
17 17
 	public function afterSetupTheme()
18 18
 	{
19
-		add_editor_style( Theme::assetUri( 'css/editor.css' ));
19
+		add_editor_style( Theme::assetUri( 'css/editor.css' ) );
20 20
 		add_theme_support( 'customize-selective-refresh-widgets' );
21 21
 		add_theme_support( 'html5', ['caption', 'comment-form', 'comment-list', 'gallery', 'search-form'] );
22 22
 		add_theme_support( 'post-thumbnails' );
@@ -26,11 +26,11 @@  discard block
 block discarded – undo
26 26
 		add_theme_support( 'soil-nice-search' );
27 27
 		add_theme_support( 'soil-relative-urls' );
28 28
 		add_theme_support( 'title-tag' );
29
-		load_theme_textdomain( 'castor', Theme::paths( 'dir.template' ) . '/languages' );
29
+		load_theme_textdomain( 'castor', Theme::paths( 'dir.template' ).'/languages' );
30 30
 
31 31
 		$menus = apply_filters( 'castor/register/nav_menus', [
32 32
 			'main_menu' => __( 'Main Menu', 'castor' ),
33
-		]);
33
+		] );
34 34
 
35 35
 		foreach( $menus as $location => $description ) {
36 36
 			register_nav_menu( $location, $description );
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 		if( Theme::displaySidebar() ) {
47 47
 			$classes[] = 'has-sidebar';
48 48
 		}
49
-		return array_keys( array_flip( $classes ));
49
+		return array_keys( array_flip( $classes ) );
50 50
 	}
51 51
 
52 52
 	/**
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 	 */
74 74
 	public function filterTemplate( $template )
75 75
 	{
76
-		if( is_string( $template )) {
76
+		if( is_string( $template ) ) {
77 77
 			$template = Template::setLayout( $template );
78 78
 			Development::storeTemplatePath( $template );
79 79
 		}
@@ -98,8 +98,8 @@  discard block
 block discarded – undo
98 98
 	 */
99 99
 	public function loadAdminFavicon()
100 100
 	{
101
-		if( file_exists( Theme::assetPath( 'favicon/favicon-admin.ico' ))) {
102
-			printf( '<link rel="shortcut icon" href="%s">', Theme::assetUri( 'favicon/favicon-admin.ico' ));
101
+		if( file_exists( Theme::assetPath( 'favicon/favicon-admin.ico' ) ) ) {
102
+			printf( '<link rel="shortcut icon" href="%s">', Theme::assetUri( 'favicon/favicon-admin.ico' ) );
103 103
 		}
104 104
 	}
105 105
 
@@ -109,8 +109,8 @@  discard block
 block discarded – undo
109 109
 	 */
110 110
 	public function login()
111 111
 	{
112
-		if( file_exists( Theme::assetPath( 'css/login.css' ))) {
113
-			printf( '<link rel="stylesheet" href="%s">', Theme::assetUri( 'css/login.css' ));
112
+		if( file_exists( Theme::assetPath( 'css/login.css' ) ) ) {
113
+			printf( '<link rel="stylesheet" href="%s">', Theme::assetUri( 'css/login.css' ) );
114 114
 		}
115 115
 	}
116 116
 
@@ -120,14 +120,14 @@  discard block
 block discarded – undo
120 120
 	 */
121 121
 	public function registerAdminAssets()
122 122
 	{
123
-		if( file_exists( Theme::assetPath( 'css/admin.css' ))) {
123
+		if( file_exists( Theme::assetPath( 'css/admin.css' ) ) ) {
124 124
 			wp_enqueue_style( 'castor/admin.css',
125 125
 				Theme::assetUri( 'css/admin.css' ),
126 126
 				apply_filters( 'castor/enqueue/admin/css/deps', [] ),
127 127
 				null
128 128
 			);
129 129
 		}
130
-		if( file_exists( Theme::assetPath( 'css/admin.js' ))) {
130
+		if( file_exists( Theme::assetPath( 'css/admin.js' ) ) ) {
131 131
 			wp_enqueue_script( 'castor/admin.js',
132 132
 				Theme::assetUri( 'js/admin.js' ),
133 133
 				apply_filters( 'castor/enqueue/admin/js/deps', [] ),
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
 		wp_localize_script( 'castor/main.js', apply_filters( 'castor/enqueue/js/localize/variable', 'globals' ),
158 158
 			apply_filters( 'castor/enqueue/js/localize/variables', [
159 159
 				'ajax' => admin_url( 'admin-ajax.php' ),
160
-			])
160
+			] )
161 161
 		);
162 162
 	}
163 163
 
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
 			'render_callback' => function() {
174 174
 				bloginfo( 'name' );
175 175
 			},
176
-		]);
176
+		] );
177 177
 	}
178 178
 
179 179
 	/**
@@ -196,15 +196,15 @@  discard block
 block discarded – undo
196 196
 			'after_widget'  => '</div>',
197 197
 			'before_title'  => '<h4>',
198 198
 			'after_title'   => '</h4>',
199
-		]);
199
+		] );
200 200
 
201 201
 		$sidebars = apply_filters( 'castor/register/sidebars', [
202 202
 			'sidebar-primary' => __( 'Primary Sidebar', 'castor' ),
203 203
 			'sidebar-footer'  => __( 'Footer Widgets', 'castor' ),
204
-		]);
204
+		] );
205 205
 
206 206
 		foreach( $sidebars as $id => $name ) {
207
-			register_sidebar([
207
+			register_sidebar( [
208 208
 				'id'   => $id,
209 209
 				'name' => $name,
210 210
 			] + $defaults );
Please login to merge, or discard this patch.
src/AliasLoader.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 	 */
41 41
 	public static function getInstance( array $aliases = [] )
42 42
 	{
43
-		if( is_null( static::$instance )) {
43
+		if( is_null( static::$instance ) ) {
44 44
 			return static::$instance = new static( $aliases );
45 45
 		}
46 46
 
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 	 */
61 61
 	public function load( $alias )
62 62
 	{
63
-		if( isset( $this->aliases[$alias] )) {
63
+		if( isset( $this->aliases[$alias] ) ) {
64 64
 			return class_alias( $this->aliases[$alias], $alias );
65 65
 		}
66 66
 	}
Please login to merge, or discard this patch.
src/Facade.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -102,11 +102,11 @@
 block discarded – undo
102 102
 	 */
103 103
 	protected static function resolveFacadeInstance( $name )
104 104
 	{
105
-		if( is_object( $name )) {
105
+		if( is_object( $name ) ) {
106 106
 			return $name;
107 107
 		}
108 108
 
109
-		if( isset( static::$resolvedInstance[$name] )) {
109
+		if( isset( static::$resolvedInstance[$name] ) ) {
110 110
 			return static::$resolvedInstance[$name];
111 111
 		}
112 112
 
Please login to merge, or discard this patch.
src/Image.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 	public function get( $attachment )
27 27
 	{
28 28
 		$attachment = $this->normalize( $attachment );
29
-		if( $attachment && $thumbnail = wp_get_attachment_image_src( $attachment, 'thumbnail' )) {
29
+		if( $attachment && $thumbnail = wp_get_attachment_image_src( $attachment, 'thumbnail' ) ) {
30 30
 			$medium = $this->normalizeSrc( wp_get_attachment_image_src( $attachment, 'medium' ), $thumbnail );
31 31
 			$large = $this->normalizeSrc( wp_get_attachment_image_src( $attachment, 'large' ), $medium );
32 32
 
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 
54 54
 	protected function normalize( $attachmentId )
55 55
 	{
56
-		if( !filter_var( $attachmentId, FILTER_VALIDATE_INT )) {
56
+		if( !filter_var( $attachmentId, FILTER_VALIDATE_INT ) ) {
57 57
 			$attachmentId = $this->postmeta->get( $attachmentId );
58 58
 		}
59 59
 
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 	 */
72 72
 	protected function normalizeSrc( array $image, $fallback = false )
73 73
 	{
74
-		if( is_array( $fallback ) && count( array_diff( $image, $fallback )) < 2 ) {
74
+		if( is_array( $fallback ) && count( array_diff( $image, $fallback ) ) < 2 ) {
75 75
 			$image = $fallback;
76 76
 		}
77 77
 		return [
Please login to merge, or discard this patch.
src/Services/Validator.php 1 patch
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 			foreach( $rules as $rule ) {
79 79
 				$this->validateAttribute( $rule, $attribute );
80 80
 
81
-				if( $this->shouldStopValidating( $attribute ))break;
81
+				if( $this->shouldStopValidating( $attribute ) )break;
82 82
 			}
83 83
 		}
84 84
 
@@ -97,10 +97,10 @@  discard block
 block discarded – undo
97 97
 	{
98 98
 		$message = $this->getMessage( $attribute, $rule, $parameters );
99 99
 
100
-		$this->errors[ $attribute ]['errors'][] = $message;
100
+		$this->errors[$attribute]['errors'][] = $message;
101 101
 
102
-		if( !isset( $this->errors[ $attribute ]['value'] )) {
103
-			$this->errors[ $attribute ]['value'] = $this->getValue( $attribute );
102
+		if( !isset( $this->errors[$attribute]['value'] ) ) {
103
+			$this->errors[$attribute]['value'] = $this->getValue( $attribute );
104 104
 		}
105 105
 	}
106 106
 
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 	{
117 117
 		$this->addError( $attribute, $rule, $parameters );
118 118
 
119
-		$this->failedRules[ $attribute ][ $rule ] = $parameters;
119
+		$this->failedRules[$attribute][$rule] = $parameters;
120 120
 	}
121 121
 
122 122
 	/**
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
 	 */
143 143
 	protected function getMessage( $attribute, $rule, array $parameters )
144 144
 	{
145
-		if( in_array( $rule, $this->sizeRules )) {
145
+		if( in_array( $rule, $this->sizeRules ) ) {
146 146
 			return $this->getSizeMessage( $attribute, $rule, $parameters );
147 147
 		}
148 148
 
@@ -161,15 +161,15 @@  discard block
 block discarded – undo
161 161
 	 */
162 162
 	protected function getRule( $attribute, $rules )
163 163
 	{
164
-		if( !array_key_exists( $attribute, $this->rules ))return;
164
+		if( !array_key_exists( $attribute, $this->rules ) )return;
165 165
 
166 166
 		$rules = (array) $rules;
167 167
 
168
-		foreach( $this->rules[ $attribute ] as $rule ) {
168
+		foreach( $this->rules[$attribute] as $rule ) {
169 169
 			list( $rule, $parameters ) = $this->parseRule( $rule );
170 170
 
171
-			if( in_array( $rule, $rules )) {
172
-				return [ $rule, $parameters ];
171
+			if( in_array( $rule, $rules ) ) {
172
+				return [$rule, $parameters];
173 173
 			}
174 174
 		}
175 175
 	}
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
 		if( is_numeric( $value ) && $hasNumeric ) {
190 190
 			return $value;
191 191
 		}
192
-		elseif( is_array( $value )) {
192
+		elseif( is_array( $value ) ) {
193 193
 			return count( $value );
194 194
 		}
195 195
 
@@ -223,8 +223,8 @@  discard block
 block discarded – undo
223 223
 	 */
224 224
 	protected function getValue( $attribute )
225 225
 	{
226
-		if( isset( $this->data[ $attribute ] )) {
227
-			return $this->data[ $attribute ];
226
+		if( isset( $this->data[$attribute] ) ) {
227
+			return $this->data[$attribute];
228 228
 		}
229 229
 	}
230 230
 
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
 	 */
239 239
 	protected function hasRule( $attribute, $rules )
240 240
 	{
241
-		return !is_null( $this->getRule( $attribute, $rules ));
241
+		return !is_null( $this->getRule( $attribute, $rules ) );
242 242
 	}
243 243
 
244 244
 	/**
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
 	protected function normalizeData( $data )
252 252
 	{
253 253
 		// If an object was provided, get its public properties
254
-		if( is_object( $data )) {
254
+		if( is_object( $data ) ) {
255 255
 			$this->data = get_object_vars( $data );
256 256
 		}
257 257
 		else {
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
 	protected function parseParameters( $rule, $parameter )
273 273
 	{
274 274
 		if( strtolower( $rule ) == 'regex' ) {
275
-			return [ $parameter ];
275
+			return [$parameter];
276 276
 		}
277 277
 
278 278
 		return str_getcsv( $parameter );
@@ -297,10 +297,10 @@  discard block
 block discarded – undo
297 297
 			$parameters = $this->parseParameters( $rule, $parameter );
298 298
 		}
299 299
 
300
-		$rule = ucwords( str_replace( ['-', '_'], ' ', trim( $rule )));
300
+		$rule = ucwords( str_replace( ['-', '_'], ' ', trim( $rule ) ) );
301 301
 		$rule = str_replace( ' ', '', $rule );
302 302
 
303
-		return [ $rule, $parameters ];
303
+		return [$rule, $parameters];
304 304
 	}
305 305
 
306 306
 	/**
@@ -312,7 +312,7 @@  discard block
 block discarded – undo
312 312
 	 */
313 313
 	protected function replaceBetween( $message, array $parameters )
314 314
 	{
315
-		return str_replace([':min', ':max'], $parameters, $message );
315
+		return str_replace( [':min', ':max'], $parameters, $message );
316 316
 	}
317 317
 
318 318
 	/**
@@ -363,7 +363,7 @@  discard block
 block discarded – undo
363 363
 	protected function setRules( array $rules )
364 364
 	{
365 365
 		foreach( $rules as $key => $rule ) {
366
-			$rules[ $key ] = is_string( $rule ) ? explode( '|', $rule ) : $rule;
366
+			$rules[$key] = is_string( $rule ) ? explode( '|', $rule ) : $rule;
367 367
 		}
368 368
 
369 369
 		$this->rules = $rules;
@@ -381,8 +381,8 @@  discard block
 block discarded – undo
381 381
 	protected function shouldStopValidating( $attribute )
382 382
 	{
383 383
 		return $this->hasRule( $attribute, $this->implicitRules )
384
-			&& isset( $this->failedRules[ $attribute ] )
385
-			&& array_intersect( array_keys( $this->failedRules[ $attribute ] ), $this->implicitRules );
384
+			&& isset( $this->failedRules[$attribute] )
385
+			&& array_intersect( array_keys( $this->failedRules[$attribute] ), $this->implicitRules );
386 386
 	}
387 387
 
388 388
 	/**
@@ -394,7 +394,7 @@  discard block
 block discarded – undo
394 394
 	 */
395 395
 	protected function snakeCase( $string )
396 396
 	{
397
-		if( !ctype_lower( $string )) {
397
+		if( !ctype_lower( $string ) ) {
398 398
 			$string = preg_replace( '/\s+/u', '', $string );
399 399
 			$string = preg_replace( '/(.)(?=[A-Z])/u', '$1_', $string );
400 400
 			$string = mb_strtolower( $string, 'UTF-8' );
@@ -416,15 +416,15 @@  discard block
 block discarded – undo
416 416
 	{
417 417
 		$strings = glsr_resolve( 'Strings' )->validation();
418 418
 
419
-		$message = isset( $strings[ $key ] )
420
-			? $strings[ $key ]
419
+		$message = isset( $strings[$key] )
420
+			? $strings[$key]
421 421
 			: false;
422 422
 
423 423
 		if( !$message )return;
424 424
 
425 425
 		$message = str_replace( ':attribute', $attribute, $message );
426 426
 
427
-		if( method_exists( $this, $replacer = "replace{$rule}" )) {
427
+		if( method_exists( $this, $replacer = "replace{$rule}" ) ) {
428 428
 			$message = $this->$replacer( $message, $parameters );
429 429
 		}
430 430
 
@@ -467,11 +467,11 @@  discard block
 block discarded – undo
467 467
 
468 468
 		$method = "validate{$rule}";
469 469
 
470
-		if( !method_exists( $this, $method )) {
470
+		if( !method_exists( $this, $method ) ) {
471 471
 			throw new BadMethodCallException( "Method [$method] does not exist." );
472 472
 		}
473 473
 
474
-		if( !$this->$method( $this->getValue( $attribute ), $attribute, $parameters )) {
474
+		if( !$this->$method( $this->getValue( $attribute ), $attribute, $parameters ) ) {
475 475
 			$this->addFailure( $attribute, $rule, $parameters );
476 476
 		}
477 477
 	}
@@ -556,7 +556,7 @@  discard block
 block discarded – undo
556 556
 	 */
557 557
 	protected function validateRequired( $value )
558 558
 	{
559
-		if( is_string( $value )) {
559
+		if( is_string( $value ) ) {
560 560
 			$value = trim( $value );
561 561
 		}
562 562
 		return is_null( $value ) || empty( $value )
Please login to merge, or discard this patch.
src/Services/Email.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 		$this->to          = $email['to'];
56 56
 
57 57
 		add_action( 'phpmailer_init', function( PHPMailer $phpmailer ) {
58
-			if( $phpmailer->ContentType === 'text/plain' || !empty( $phpmailer->AltBody ))return;
58
+			if( $phpmailer->ContentType === 'text/plain' || !empty( $phpmailer->AltBody ) )return;
59 59
 			$phpmailer->AltBody = $this->buildPlainTextMessage( $phpmailer->Body );
60 60
 		});
61 61
 
@@ -106,11 +106,11 @@  discard block
 block discarded – undo
106 106
 			'reply-to',
107 107
 		];
108 108
 
109
-		$headers = array_intersect_key( $email, array_flip( $allowed ));
109
+		$headers = array_intersect_key( $email, array_flip( $allowed ) );
110 110
 		$headers = array_filter( $headers );
111 111
 
112 112
 		foreach( $headers as $key => $value ) {
113
-			unset( $headers[ $key ] );
113
+			unset( $headers[$key] );
114 114
 			$headers[] = sprintf( '%s: %s', $key, $value );
115 115
 		}
116 116
 
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
 			? $this->renderTemplate( $email['template'], $email['template-tags'] )
131 131
 			: $email['message'];
132 132
 
133
-		$message = $this->filterHtml( $email['before'] . $message . $email['after'] );
133
+		$message = $this->filterHtml( $email['before'].$message.$email['after'] );
134 134
 		$message = str_replace( '{message}', $message, $body );
135 135
 
136 136
 		return apply_filters( 'castor/email/message', $message, 'html', $this );
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
 	 */
178 178
 	protected function normalize( $email )
179 179
 	{
180
-		$defaults = array_fill_keys([
180
+		$defaults = array_fill_keys( [
181 181
 			'after', 'attachments', 'bcc', 'before', 'cc', 'from', 'message', 'reply-to', 'subject',
182 182
 			'template', 'template-tags', 'to',
183 183
 		], '' );
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
 		foreach( ['attachments', 'template-tags'] as $key ) {
189 189
 			$email[$key] = array_filter( (array) $email[$key] );
190 190
 		}
191
-		if( empty( $email['reply-to'] )) {
191
+		if( empty( $email['reply-to'] ) ) {
192 192
 			$email['reply-to'] = $email['from'];
193 193
 		}
194 194
 
@@ -204,12 +204,12 @@  discard block
 block discarded – undo
204 204
 	 */
205 205
 	protected function renderTemplate( $templatePath, array $args = [] )
206 206
 	{
207
-		$file = $this->template->get( sprintf( 'castor/%s', $templatePath ));
207
+		$file = $this->template->get( sprintf( 'castor/%s', $templatePath ) );
208 208
 
209
-		if( !file_exists( $file )) {
209
+		if( !file_exists( $file ) ) {
210 210
 			$file = sprintf( '%s/templates/%s.php', dirname( __DIR__ ), $templatePath );
211 211
 		}
212
-		if( !file_exists( $file ))return;
212
+		if( !file_exists( $file ) )return;
213 213
 
214 214
 		ob_start();
215 215
 		include $file;
Please login to merge, or discard this patch.
src/Services/Normalizer.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 		foreach( $attributes as $key => $value ) {
102 102
 			// if data attributes, use single quotes in case of json encoded values
103 103
 			$quotes = false !== stripos( $key, 'data-' ) ? "'" : '"';
104
-			if( is_array( $value )) {
104
+			if( is_array( $value ) ) {
105 105
 				$value = json_encode( $value );
106 106
 				$quotes = "'";
107 107
 			}
@@ -144,29 +144,29 @@  discard block
 block discarded – undo
144 144
 	 */
145 145
 	protected function filterAttributes( array $attributeKeys )
146 146
 	{
147
-		$filtered = array_intersect_key( $this->args, array_flip( $attributeKeys ));
147
+		$filtered = array_intersect_key( $this->args, array_flip( $attributeKeys ) );
148 148
 
149 149
 		// normalize truthy boolean attributes
150 150
 		foreach( $filtered as $key => $value ) {
151
-			if( !in_array( $key, self::BOOLEAN_ATTRIBUTES ))continue;
151
+			if( !in_array( $key, self::BOOLEAN_ATTRIBUTES ) )continue;
152 152
 
153 153
 			if( $value !== false ) {
154
-				$filtered[ $key ] = '';
154
+				$filtered[$key] = '';
155 155
 				continue;
156 156
 			}
157 157
 
158
-			unset( $filtered[ $key ] );
158
+			unset( $filtered[$key] );
159 159
 		}
160 160
 
161 161
 		$filteredKeys = array_filter( array_keys( $filtered ), function( $key ) use ( $filtered ) {
162 162
 			return !(
163
-				empty( $filtered[ $key ] )
164
-				&& !is_numeric( $filtered[ $key ] )
163
+				empty( $filtered[$key] )
164
+				&& !is_numeric( $filtered[$key] )
165 165
 				&& !in_array( $key, self::BOOLEAN_ATTRIBUTES )
166 166
 			);
167 167
 		});
168 168
 
169
-		return array_intersect_key( $filtered, array_flip( $filteredKeys ));
169
+		return array_intersect_key( $filtered, array_flip( $filteredKeys ) );
170 170
 	}
171 171
 
172 172
 	/**
@@ -183,20 +183,20 @@  discard block
 block discarded – undo
183 183
 			foreach( $this->args as $key => $value ) {
184 184
 
185 185
 				$length = strlen( $wildcard );
186
-				$result = substr( $key, 0, $length) === $wildcard;
186
+				$result = substr( $key, 0, $length ) === $wildcard;
187 187
 
188 188
 				if( $result ) {
189 189
 					// only allow data attributes to have an empty value
190
-					if( $wildcard != 'data-' && empty( $value ))continue;
190
+					if( $wildcard != 'data-' && empty( $value ) )continue;
191 191
 
192
-					if( is_array( $value )) {
192
+					if( is_array( $value ) ) {
193 193
 
194 194
 						if( $wildcard != 'data-' )continue;
195 195
 
196 196
 						$value = json_encode( $value );
197 197
 					}
198 198
 
199
-					$wildcards[ $key ] = $value;
199
+					$wildcards[$key] = $value;
200 200
 				}
201 201
 			}
202 202
 		}
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
 	 */
210 210
 	protected function filterInputType()
211 211
 	{
212
-		if( !isset( $this->args['type'] ) || !in_array( $this->args['type'], self::INPUT_TYPES )) {
212
+		if( !isset( $this->args['type'] ) || !in_array( $this->args['type'], self::INPUT_TYPES ) ) {
213 213
 			$this->args['type'] = 'text';
214 214
 		}
215 215
 	}
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
 	 */
220 220
 	protected function parseAttributes( array $attributes, array $args = [] )
221 221
 	{
222
-		if( !empty( $args )) {
222
+		if( !empty( $args ) ) {
223 223
 			$this->args = array_change_key_case( $args );
224 224
 		}
225 225
 
Please login to merge, or discard this patch.
src/Video.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 
42 42
 	public function render()
43 43
 	{
44
-		if( !isset( $this->video->html ))return;
44
+		if( !isset( $this->video->html ) )return;
45 45
 		return sprintf(
46 46
 			'<div class="video embed">%s%s</div>',
47 47
 			$this->renderScreenshot(),
@@ -52,11 +52,11 @@  discard block
 block discarded – undo
52 52
 	public function renderPlayButton()
53 53
 	{
54 54
 		return sprintf(
55
-			'<div class="video-play">' .
56
-				'<div class="video-play-pulse pulse1"></div>' .
57
-				'<div class="video-play-pulse pulse2"></div>' .
58
-				'<div class="video-play-pulse pulse3"></div>' .
59
-				'<a href="%s" class="video-play-btn">%s</a>' .
55
+			'<div class="video-play">'.
56
+				'<div class="video-play-pulse pulse1"></div>'.
57
+				'<div class="video-play-pulse pulse2"></div>'.
58
+				'<div class="video-play-pulse pulse3"></div>'.
59
+				'<a href="%s" class="video-play-btn">%s</a>'.
60 60
 			'</div>',
61 61
 			$this->args['url'],
62 62
 			$this->theme->svg( 'play.svg' )
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 	public function renderScreenshot()
67 67
 	{
68 68
 		if( $this->args['image']
69
-			&& in_array( strtolower( $this->video->provider_name ), $this->supported )) {
69
+			&& in_array( strtolower( $this->video->provider_name ), $this->supported ) ) {
70 70
 			return sprintf( '%s<div class="video-poster" style="background-image: url(%s)">%s</div>',
71 71
 				$this->renderSpinner(),
72 72
 				$this->args['image'],
@@ -78,10 +78,10 @@  discard block
 block discarded – undo
78 78
 	public function renderSpinner()
79 79
 	{
80 80
 		return sprintf(
81
-			'<div class="video-spinner">' .
82
-				'<div class="spinner"><div class="spinner-dots">%s</div></div>' .
81
+			'<div class="video-spinner">'.
82
+				'<div class="spinner"><div class="spinner-dots">%s</div></div>'.
83 83
 			'</div>',
84
-			implode( '', array_fill( 0, 8, '<div class="spinner-dot"></div>' ))
84
+			implode( '', array_fill( 0, 8, '<div class="spinner-dot"></div>' ) )
85 85
 		);
86 86
 	}
87 87
 
@@ -102,11 +102,11 @@  discard block
 block discarded – undo
102 102
 
103 103
 	protected function normalize( $args )
104 104
 	{
105
-		if( is_string( $args )) {
105
+		if( is_string( $args ) ) {
106 106
 			$args = ['url' => $args];
107 107
 		}
108 108
 
109
-		$this->args = shortcode_atts([
109
+		$this->args = shortcode_atts( [
110 110
 			'image'  => '', // string || int
111 111
 			'player' => '', // string || array
112 112
 			'url'    => '', // string
@@ -114,8 +114,8 @@  discard block
 block discarded – undo
114 114
 
115 115
 		foreach( $this->args as $key => $value ) {
116 116
 			$method = $this->utility->buildMethodName( $key, 'set' );
117
-			if( !method_exists( $this, $method ))continue;
118
-			call_user_func([ $this, $method ], $value );
117
+			if( !method_exists( $this, $method ) )continue;
118
+			call_user_func( [$this, $method], $value );
119 119
 		}
120 120
 		return $this->args;
121 121
 	}
Please login to merge, or discard this patch.
src/Gallery.php 1 patch
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 	{
35 35
 		$this->normalizeArgs( $args );
36 36
 
37
-		$this->gallery = new WP_Query([
37
+		$this->gallery = new WP_Query( [
38 38
 			'orderby'        => 'post__in',
39 39
 			'paged'          => $this->getPaged(),
40 40
 			'post__in'       => $this->args['media'],
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 			'post_type'      => 'attachment',
43 43
 			'post_status'    => 'inherit',
44 44
 			'posts_per_page' => $this->args['images_per_page'],
45
-		]);
45
+		] );
46 46
 
47 47
 		return $this;
48 48
 	}
@@ -52,9 +52,9 @@  discard block
 block discarded – undo
52 52
 	 */
53 53
 	public function render()
54 54
 	{
55
-		if( empty( $this->args['media'] ))return;
55
+		if( empty( $this->args['media'] ) )return;
56 56
 		$images = array_reduce( $this->gallery->posts, function( $images, $attachment ) {
57
-			return $images . $this->renderImage( $attachment );
57
+			return $images.$this->renderImage( $attachment );
58 58
 		});
59 59
 		return sprintf( '<div class="gallery-images" itemscope itemtype="http://schema.org/ImageGallery">%s</div>%s',
60 60
 			$images,
@@ -71,8 +71,8 @@  discard block
 block discarded – undo
71 71
 
72 72
 		if( !$image )return;
73 73
 		return sprintf(
74
-			'<figure class="gallery-image" data-w="%s" data-h="%s" data-ps=\'%s\' itemprop="associatedMedia" itemscope itemtype="http://schema.org/ImageObject">' .
75
-				'%s%s' .
74
+			'<figure class="gallery-image" data-w="%s" data-h="%s" data-ps=\'%s\' itemprop="associatedMedia" itemscope itemtype="http://schema.org/ImageObject">'.
75
+				'%s%s'.
76 76
 			'</figure>',
77 77
 			$image->thumbnail['width'],
78 78
 			$image->thumbnail['height'],
@@ -88,14 +88,14 @@  discard block
 block discarded – undo
88 88
 	public function renderPagination()
89 89
 	{
90 90
 		if( !$this->args['pagination'] )return;
91
-		return paginate_links([
92
-			'before_page_number' => '<span class="screen-reader-text">' . __( 'Page', 'castor' ) . ' </span>',
91
+		return paginate_links( [
92
+			'before_page_number' => '<span class="screen-reader-text">'.__( 'Page', 'castor' ).' </span>',
93 93
 			'current'            => $this->gallery->query['paged'],
94 94
 			'mid_size'           => 1,
95 95
 			'next_text'          => __( 'Next', 'castor' ),
96 96
 			'prev_text'          => __( 'Previous', 'castor' ),
97 97
 			'total'              => $this->gallery->max_num_pages,
98
-		]);
98
+		] );
99 99
 	}
100 100
 
101 101
 	/**
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 	{
109 109
 		$bool = $this->getValue( $key, $value );
110 110
 
111
-		if( is_null( filter_var( $bool, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE ))) {
111
+		if( is_null( filter_var( $bool, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE ) ) ) {
112 112
 			$bool = $this->postmeta->get( $bool );
113 113
 		}
114 114
 		return wp_validate_boolean( $bool );
@@ -123,10 +123,10 @@  discard block
 block discarded – undo
123 123
 	{
124 124
 		$gallery = $this->getValue( 'gallery', $value );
125 125
 
126
-		if( !is_numeric( $gallery ) && is_string( $gallery )) {
127
-			$gallery = intval( $this->postmeta->get( $gallery ));
126
+		if( !is_numeric( $gallery ) && is_string( $gallery ) ) {
127
+			$gallery = intval( $this->postmeta->get( $gallery ) );
128 128
 		}
129
-		return !is_null( get_post( $gallery ))
129
+		return !is_null( get_post( $gallery ) )
130 130
 			? intval( $gallery )
131 131
 			: 0;
132 132
 	}
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
 	{
141 141
 		$perPage = $this->getValue( 'images_per_page', $value );
142 142
 
143
-		if( !is_numeric( $perPage ) && is_string( $perPage )) {
143
+		if( !is_numeric( $perPage ) && is_string( $perPage ) ) {
144 144
 			$perPage = $this->postmeta->get( $perPage );
145 145
 		}
146 146
 		return !!intval( $perPage )
@@ -167,11 +167,11 @@  discard block
 block discarded – undo
167 167
 	{
168 168
 		$media = $this->getValue( 'media', $value );
169 169
 
170
-		if( is_string( $media )) {
170
+		if( is_string( $media ) ) {
171 171
 			$media = $this->postmeta->get( $media, [
172 172
 				'ID'     => $this->getGalleryArg(),
173 173
 				'single' => false,
174
-			]);
174
+			] );
175 175
 		}
176 176
 		return is_array( $media )
177 177
 			? wp_parse_id_list( $media )
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
 	 */
184 184
 	protected function getPaged()
185 185
 	{
186
-		return intval( get_query_var(( is_front_page() ? 'page' : 'paged' ))) ?: 1;
186
+		return intval( get_query_var( ( is_front_page() ? 'page' : 'paged' ) ) ) ?: 1;
187 187
 	}
188 188
 
189 189
 	/**
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
 	 */
230 230
 	protected function getValue( $key, $value = null )
231 231
 	{
232
-		if( is_null( $value ) && isset( $this->args[$key] )) {
232
+		if( is_null( $value ) && isset( $this->args[$key] ) ) {
233 233
 			$value = $this->args[$key];
234 234
 		}
235 235
 		return $value;
@@ -241,20 +241,20 @@  discard block
 block discarded – undo
241 241
 	protected function normalizeArgs( array $args = [] )
242 242
 	{
243 243
 		$defaults = [
244
-			'gallery',         // (string) meta_key | (int) post_id
245
-			'lazyload',        // (string) meta_key | (bool)
246
-			'media',           // (string) meta_key | (array) post_ids
247
-			'pagination',      // (string) meta_key | (bool)
244
+			'gallery', // (string) meta_key | (int) post_id
245
+			'lazyload', // (string) meta_key | (bool)
246
+			'media', // (string) meta_key | (array) post_ids
247
+			'pagination', // (string) meta_key | (bool)
248 248
 			'images_per_page', // (string) meta_key | (int) number
249
-			'permalinks',      // (string) meta_key | (bool)
249
+			'permalinks', // (string) meta_key | (bool)
250 250
 		];
251 251
 
252 252
 		$this->args = shortcode_atts( array_combine( $defaults, $defaults ), $args );
253 253
 
254 254
 		array_walk( $this->args, function( &$value, $key ) {
255
-			$method = $this->utility->buildMethodName( $key . '_arg' );
256
-			if( method_exists( $this, $method )) {
257
-				$value = call_user_func([ $this, $method ], $value );
255
+			$method = $this->utility->buildMethodName( $key.'_arg' );
256
+			if( method_exists( $this, $method ) ) {
257
+				$value = call_user_func( [$this, $method], $value );
258 258
 			}
259 259
 		});
260 260
 
@@ -267,10 +267,10 @@  discard block
 block discarded – undo
267 267
 	 */
268 268
 	protected function renderImageCaption( $image )
269 269
 	{
270
-		if( !empty( $image->copyright )) {
270
+		if( !empty( $image->copyright ) ) {
271 271
 			$image->caption .= sprintf( ' <span itemprop="copyrightHolder">%s</span>', $image->copyright );
272 272
 		}
273
-		if( empty( $image->caption ))return;
273
+		if( empty( $image->caption ) )return;
274 274
 		return sprintf( '<figcaption itemprop="caption description">%s</figcaption>', $image->caption );
275 275
 	}
276 276
 
Please login to merge, or discard this patch.