Passed
Push — develop ( cbc137...bc604e )
by Paul
14:17
created
src/Oembed.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -32,11 +32,11 @@  discard block
 block discarded – undo
32 32
 	{
33 33
 		$args = wp_parse_args( $args, [
34 34
 			'embed_type' => '',
35
-		]);
35
+		] );
36 36
 		$request = $this->oembed->fetch( $this->oembed->get_provider( $url ), $url, [
37 37
 			'width'  => 1280,
38 38
 			'height' => 1280,
39
-		]);
39
+		] );
40 40
 		if( $request === false )return;
41 41
 		if( !empty( $args['embed_type'] ) && $args['embed_type'] != $request->type )return;
42 42
 		return $this->modifyRequest( $request, $args );
@@ -56,13 +56,13 @@  discard block
 block discarded – undo
56 56
 			? $this->$providerName
57 57
 			: [];
58 58
 
59
-		$method = $this->utility->buildMethodName( $providerName . '_request', 'modify' );
59
+		$method = $this->utility->buildMethodName( $providerName.'_request', 'modify' );
60 60
 
61
-		if( method_exists( $this, $method )) {
61
+		if( method_exists( $this, $method ) ) {
62 62
 			return call_user_func( [$this, $method], $request, array_intersect_key(
63 63
 				$args,
64 64
 				array_flip( $provider )
65
-			));
65
+			) );
66 66
 		}
67 67
 		return $request;
68 68
 	}
@@ -70,18 +70,18 @@  discard block
 block discarded – undo
70 70
 	protected function modifyYoutubeRequest( $request, array $args )
71 71
 	{
72 72
 		$html = $this->domLoad( $request->html );
73
-		$node = $html->getElementsByTagName( 'iframe' )->item(0);
73
+		$node = $html->getElementsByTagName( 'iframe' )->item( 0 );
74 74
 		$url  = $node->getAttribute( 'src' );
75 75
 
76 76
 		if( isset( $args['fs'] ) && $args['fs'] == 0 ) {
77 77
 			$node->removeAttribute( 'allowfullscreen' );
78 78
 		}
79 79
 
80
-		$args['origin'] = urlencode( get_bloginfo( 'url' ));
80
+		$args['origin'] = urlencode( get_bloginfo( 'url' ) );
81 81
 
82 82
 		$node->setAttribute( 'class', 'video-embed' );
83 83
 		$node->setAttribute( 'src',
84
-			add_query_arg( $args, remove_query_arg( 'feature', $url ))
84
+			add_query_arg( $args, remove_query_arg( 'feature', $url ) )
85 85
 		);
86 86
 
87 87
 		$request->html = $html->saveHTML( $node );
Please login to merge, or discard this patch.
Braces   +7 added lines, -4 removed lines patch added patch discarded remove patch
@@ -5,8 +5,7 @@  discard block
 block discarded – undo
5 5
 use GeminiLabs\Castor\Helpers\Utility;
6 6
 use DomDocument;
7 7
 
8
-class Oembed
9
-{
8
+class Oembed {
10 9
 	public $oembed;
11 10
 	public $utility;
12 11
 
@@ -37,8 +36,12 @@  discard block
 block discarded – undo
37 36
 			'width'  => 1280,
38 37
 			'height' => 1280,
39 38
 		]);
40
-		if( $request === false )return;
41
-		if( !empty( $args['embed_type'] ) && $args['embed_type'] != $request->type )return;
39
+		if( $request === false ) {
40
+			return;
41
+		}
42
+		if( !empty( $args['embed_type'] ) && $args['embed_type'] != $request->type ) {
43
+			return;
44
+		}
42 45
 		return $this->modifyRequest( $request, $args );
43 46
 	}
44 47
 
Please login to merge, or discard this patch.
src/Services/Validator.php 2 patches
Spacing   +28 added lines, -28 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' );
@@ -414,7 +414,7 @@  discard block
 block discarded – undo
414 414
 	 */
415 415
 	protected function translator( $key, $rule, $attribute, array $parameters )
416 416
 	{
417
-		$strings = [];//glsr_resolve( 'Strings' )->validation();
417
+		$strings = []; //glsr_resolve( 'Strings' )->validation();
418 418
 
419 419
 		$message = isset( $strings[$key] )
420 420
 			? $strings[$key]
@@ -424,7 +424,7 @@  discard block
 block discarded – undo
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.
Braces   +13 added lines, -6 removed lines patch added patch discarded remove patch
@@ -5,8 +5,7 @@  discard block
 block discarded – undo
5 5
 use BadMethodCallException;
6 6
 use InvalidArgumentException;
7 7
 
8
-class Validator
9
-{
8
+class Validator {
10 9
 	/**
11 10
 	 * @var array
12 11
 	 */
@@ -78,7 +77,9 @@  discard block
 block discarded – undo
78 77
 			foreach( $rules as $rule ) {
79 78
 				$this->validateAttribute( $rule, $attribute );
80 79
 
81
-				if( $this->shouldStopValidating( $attribute ))break;
80
+				if( $this->shouldStopValidating( $attribute )) {
81
+					break;
82
+				}
82 83
 			}
83 84
 		}
84 85
 
@@ -161,7 +162,9 @@  discard block
 block discarded – undo
161 162
 	 */
162 163
 	protected function getRule( $attribute, $rules )
163 164
 	{
164
-		if( !array_key_exists( $attribute, $this->rules ))return;
165
+		if( !array_key_exists( $attribute, $this->rules )) {
166
+			return;
167
+		}
165 168
 
166 169
 		$rules = (array) $rules;
167 170
 
@@ -420,7 +423,9 @@  discard block
 block discarded – undo
420 423
 			? $strings[$key]
421 424
 			: false;
422 425
 
423
-		if( !$message )return;
426
+		if( !$message ) {
427
+			return;
428
+		}
424 429
 
425 430
 		$message = str_replace( ':attribute', $attribute, $message );
426 431
 
@@ -463,7 +468,9 @@  discard block
 block discarded – undo
463 468
 	{
464 469
 		list( $rule, $parameters ) = $this->parseRule( $rule );
465 470
 
466
-		if( $rule == '' )return;
471
+		if( $rule == '' ) {
472
+			return;
473
+		}
467 474
 
468 475
 		$method = "validate{$rule}";
469 476
 
Please login to merge, or discard this patch.
src/Helpers/Template.php 2 patches
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -6,8 +6,7 @@
 block discarded – undo
6 6
 use GeminiLabs\Castor\Facades\Log as LogFacade;
7 7
 use GeminiLabs\Castor\Facades\Utility as UtilityFacade;
8 8
 
9
-class Template
10
-{
9
+class Template {
11 10
 	/**
12 11
 	 * @var string
13 12
 	 */
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -23,15 +23,15 @@  discard block
 block discarded – undo
23 23
 	{
24 24
 		$template = UtilityFacade::startWith( 'templates/', $slug );
25 25
 		$templates = ["$template.php"];
26
-		if( !empty( $name )) {
26
+		if( !empty( $name ) ) {
27 27
 			$fileName = basename( $template );
28 28
 			$filePath = UtilityFacade::trimRight( $template, $fileName );
29
-			array_unshift( $templates, sprintf( '%s/%s.php', $filePath.$name, $fileName ));
29
+			array_unshift( $templates, sprintf( '%s/%s.php', $filePath.$name, $fileName ) );
30 30
 		}
31
-		$templates = array_unique( apply_filters( "castor/templates/$slug", $templates, $name ));
31
+		$templates = array_unique( apply_filters( "castor/templates/$slug", $templates, $name ) );
32 32
 		$template = locate_template( $templates );
33
-		if( empty( $template )) {
34
-			if( file_exists( "$slug.php" )) {
33
+		if( empty( $template ) ) {
34
+			if( file_exists( "$slug.php" ) ) {
35 35
 				return "$slug.php";
36 36
 			}
37 37
 			LogFacade::debug( "$slug not found." );
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 	 */
48 48
 	public function load( $slug, $name = '' )
49 49
 	{
50
-		if( !empty(( $template = $this->get( $slug, $name )))) {
50
+		if( !empty( ( $template = $this->get( $slug, $name ) ) ) ) {
51 51
 			DevelopmentFacade::storeTemplatePath( $template );
52 52
 			load_template( $template, false );
53 53
 		}
@@ -70,6 +70,6 @@  discard block
 block discarded – undo
70 70
 	{
71 71
 		$template = str_replace( get_stylesheet_directory().'/templates/', '', $template );
72 72
 		$this->template = UtilityFacade::trimRight( $template, '.php' );
73
-		return $this->get( apply_filters( 'castor/templates/layout', 'layouts/default' ));
73
+		return $this->get( apply_filters( 'castor/templates/layout', 'layouts/default' ) );
74 74
 	}
75 75
 }
Please login to merge, or discard this patch.
src/Helpers/Log.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
 	 */
152 152
 	protected function interpolate( $message, array $context = [] )
153 153
 	{
154
-		if( is_array( $message )) {
154
+		if( is_array( $message ) ) {
155 155
 			return htmlspecialchars( print_r( $message, true ), ENT_QUOTES, 'UTF-8' );
156 156
 		}
157 157
 		$replace = [];
@@ -159,10 +159,10 @@  discard block
 block discarded – undo
159 159
 			if( is_object( $val ) && get_class( $val ) === 'DateTime' ) {
160 160
 				$val = $val->format( 'Y-m-d H:i:s' );
161 161
 			}
162
-			else if( is_object( $val ) || is_array( $val )) {
162
+			else if( is_object( $val ) || is_array( $val ) ) {
163 163
 				$val = json_encode( $val );
164 164
 			}
165
-			else if( is_resource( $val )) {
165
+			else if( is_resource( $val ) ) {
166 166
 				$val = (string) $val;
167 167
 			}
168 168
 			$replace['{'.$key.'}'] = $val;
@@ -178,13 +178,13 @@  discard block
 block discarded – undo
178 178
 	 */
179 179
 	protected function log( $level, $message, array $context = [] )
180 180
 	{
181
-		if( !in_array( $level, (new ReflectionClass( __NAMESPACE__.'\Log' ))->getConstants(), true )
181
+		if( !in_array( $level, ( new ReflectionClass( __NAMESPACE__.'\Log' ) )->getConstants(), true )
182 182
 			|| !DevelopmentFacade::isDev()
183 183
 		)return;
184
-		$date = get_date_from_gmt( gmdate('Y-m-d H:i:s') );
184
+		$date = get_date_from_gmt( gmdate( 'Y-m-d H:i:s' ) );
185 185
 		$level = strtoupper( $level );
186 186
 		$message = $this->interpolate( $message, $context );
187
-		$entry = "[$date] $level: $message" . PHP_EOL;
188
-		file_put_contents( $this->file, $entry, FILE_APPEND|LOCK_EX );
187
+		$entry = "[$date] $level: $message".PHP_EOL;
188
+		file_put_contents( $this->file, $entry, FILE_APPEND | LOCK_EX );
189 189
 	}
190 190
 }
Please login to merge, or discard this patch.
Braces   +4 added lines, -3 removed lines patch added patch discarded remove patch
@@ -5,8 +5,7 @@  discard block
 block discarded – undo
5 5
 use GeminiLabs\Castor\Facades\Development as DevelopmentFacade;
6 6
 use ReflectionClass;
7 7
 
8
-class Log
9
-{
8
+class Log {
10 9
 	const EMERGENCY = 'emergency';
11 10
 	const ALERT = 'alert';
12 11
 	const CRITICAL  = 'critical';
@@ -180,7 +179,9 @@  discard block
 block discarded – undo
180 179
 	{
181 180
 		if( !in_array( $level, (new ReflectionClass( __NAMESPACE__.'\Log' ))->getConstants(), true )
182 181
 			|| !DevelopmentFacade::isDev()
183
-		)return;
182
+		) {
183
+			return;
184
+		}
184 185
 		$date = get_date_from_gmt( gmdate('Y-m-d H:i:s') );
185 186
 		$level = strtoupper( $level );
186 187
 		$message = $this->interpolate( $message, $context );
Please login to merge, or discard this patch.
src/Application.php 2 patches
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -6,8 +6,7 @@
 block discarded – undo
6 6
 use GeminiLabs\Castor\Container;
7 7
 use GeminiLabs\Castor\Facade;
8 8
 
9
-final class Application extends Container
10
-{
9
+final class Application extends Container {
11 10
 	public $assets;
12 11
 	public $cssDir;
13 12
 	public $imgDir;
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 
16 16
 	public function __construct()
17 17
 	{
18
-		$this->assets = sprintf( '%s/assets/', dirname( __DIR__ ));
18
+		$this->assets = sprintf( '%s/assets/', dirname( __DIR__ ) );
19 19
 		Facade::clearResolvedInstances();
20 20
 		Facade::setFacadeApplication( $this );
21 21
 		$this->registerAliases();
@@ -27,21 +27,21 @@  discard block
 block discarded – undo
27 27
 		$controller = $this->make( 'Controller' );
28 28
 
29 29
 		// Action hooks
30
-		add_action( 'after_setup_theme',      [$controller, 'afterSetupTheme'], 20 );
31
-		add_action( 'login_head',             [$controller, 'loadAdminFavicon'] );
32
-		add_action( 'admin_head',             [$controller, 'loadAdminFavicon'] );
33
-		add_action( 'login_head',             [$controller, 'login'] );
34
-		add_action( 'admin_enqueue_scripts',  [$controller, 'registerAdminAssets'] );
35
-		add_action( 'wp_enqueue_scripts',     [$controller, 'registerAssets'] );
36
-		add_action( 'customize_register',     [$controller, 'registerCustomizer'] );
30
+		add_action( 'after_setup_theme', [$controller, 'afterSetupTheme'], 20 );
31
+		add_action( 'login_head', [$controller, 'loadAdminFavicon'] );
32
+		add_action( 'admin_head', [$controller, 'loadAdminFavicon'] );
33
+		add_action( 'login_head', [$controller, 'login'] );
34
+		add_action( 'admin_enqueue_scripts', [$controller, 'registerAdminAssets'] );
35
+		add_action( 'wp_enqueue_scripts', [$controller, 'registerAssets'] );
36
+		add_action( 'customize_register', [$controller, 'registerCustomizer'] );
37 37
 		add_action( 'customize_preview_init', [$controller, 'registerCustomizerAssets'] );
38
-		add_action( 'widgets_init',           [$controller, 'registerSidebars'] );
38
+		add_action( 'widgets_init', [$controller, 'registerSidebars'] );
39 39
 
40 40
 		// Filter hooks
41
-		add_filter( 'body_class',             [$controller, 'filterBodyClasses'] );
42
-		add_filter( 'template_include',       [$controller, 'filterTemplate'] );
43
-		add_filter( 'login_headertext',       [$controller, 'filterLoginTitle'] );
44
-		add_filter( 'login_headerurl',        [$controller, 'filterLoginUrl'] );
41
+		add_filter( 'body_class', [$controller, 'filterBodyClasses'] );
42
+		add_filter( 'template_include', [$controller, 'filterTemplate'] );
43
+		add_filter( 'login_headertext', [$controller, 'filterLoginTitle'] );
44
+		add_filter( 'login_headerurl', [$controller, 'filterLoginUrl'] );
45 45
 
46 46
 		foreach( $this->getTemplateTypes() as $type ) {
47 47
 			add_filter( "{$type}_template_hierarchy", [$controller, 'filterTemplateHierarchy'] );
Please login to merge, or discard this patch.
castor.php 2 patches
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,7 +23,8 @@
 block discarded – undo
23 23
 require_once( ABSPATH.'/'.WPINC.'/class-oembed.php' );
24 24
 
25 25
 if( !function_exists( 'castor_app' )) {
26
-	function castor_app() {
26
+	function castor_app()
27
+	{
27 28
 		return \GeminiLabs\Castor\Application::getInstance();
28 29
 	}
29 30
 }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -2,19 +2,19 @@  discard block
 block discarded – undo
2 2
 
3 3
 global $wp_version;
4 4
 
5
-if( !is_admin() && version_compare( '7.0', phpversion(), '>' )) {
5
+if( !is_admin() && version_compare( '7.0', phpversion(), '>' ) ) {
6 6
 	wp_die(
7 7
 		__( 'You must be using PHP 7.0.0 or greater.', 'castor' ),
8 8
 		__( 'Unsupported PHP version', 'castor' )
9 9
 	);
10 10
 }
11
-if( !is_admin() && version_compare( '5.2', $wp_version, '>' )) {
11
+if( !is_admin() && version_compare( '5.2', $wp_version, '>' ) ) {
12 12
 	wp_die(
13 13
 		__( 'You must be using WordPress 5.2.0 or greater.', 'castor' ),
14 14
 		__( 'Unsupported WordPress version', 'castor' )
15 15
 	);
16 16
 }
17
-if( is_customize_preview() && filter_input( INPUT_GET, 'theme' )) {
17
+if( is_customize_preview() && filter_input( INPUT_GET, 'theme' ) ) {
18 18
 	wp_die(
19 19
 		__( 'Theme must be activated prior to using the customizer.', 'castor' )
20 20
 	);
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 
23 23
 require_once( ABSPATH.'/'.WPINC.'/class-oembed.php' );
24 24
 
25
-if( !function_exists( 'castor_app' )) {
25
+if( !function_exists( 'castor_app' ) ) {
26 26
 	function castor_app() {
27 27
 		return \GeminiLabs\Castor\Application::getInstance();
28 28
 	}
Please login to merge, or discard this patch.
src/Services/Email.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 		$this->to          = $email['to'];
57 57
 
58 58
 		add_action( 'phpmailer_init', function( PHPMailer $phpmailer ) {
59
-			if( $phpmailer->ContentType === 'text/plain' || !empty( $phpmailer->AltBody ))return;
59
+			if( $phpmailer->ContentType === 'text/plain' || !empty( $phpmailer->AltBody ) )return;
60 60
 			$phpmailer->AltBody = $this->buildPlainTextMessage( $phpmailer->Body );
61 61
 		});
62 62
 
@@ -107,11 +107,11 @@  discard block
 block discarded – undo
107 107
 			'reply-to',
108 108
 		];
109 109
 
110
-		$headers = array_intersect_key( $email, array_flip( $allowed ));
110
+		$headers = array_intersect_key( $email, array_flip( $allowed ) );
111 111
 		$headers = array_filter( $headers );
112 112
 
113 113
 		foreach( $headers as $key => $value ) {
114
-			unset( $headers[ $key ] );
114
+			unset( $headers[$key] );
115 115
 			$headers[] = sprintf( '%s: %s', $key, $value );
116 116
 		}
117 117
 
@@ -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
 
@@ -206,10 +206,10 @@  discard block
 block discarded – undo
206 206
 	{
207 207
 		$file = $this->template->get( 'castor/email/'.$templatePath );
208 208
 
209
-		if( !file_exists( $file )) {
210
-			$file = sprintf( '%s/templates/email/%s.php', dirname( dirname( __DIR__ )), $templatePath );
209
+		if( !file_exists( $file ) ) {
210
+			$file = sprintf( '%s/templates/email/%s.php', dirname( 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.
Braces   +10 added lines, -5 removed lines patch added patch discarded remove patch
@@ -5,8 +5,7 @@  discard block
 block discarded – undo
5 5
 use GeminiLabs\Castor\Helpers\Template;
6 6
 use PHPMailer;
7 7
 
8
-class Email
9
-{
8
+class Email {
10 9
 	/**
11 10
 	 * @var Template
12 11
 	 */
@@ -56,7 +55,9 @@  discard block
 block discarded – undo
56 55
 		$this->to          = $email['to'];
57 56
 
58 57
 		add_action( 'phpmailer_init', function( PHPMailer $phpmailer ) {
59
-			if( $phpmailer->ContentType === 'text/plain' || !empty( $phpmailer->AltBody ))return;
58
+			if( $phpmailer->ContentType === 'text/plain' || !empty( $phpmailer->AltBody )) {
59
+				return;
60
+			}
60 61
 			$phpmailer->AltBody = $this->buildPlainTextMessage( $phpmailer->Body );
61 62
 		});
62 63
 
@@ -80,7 +81,9 @@  discard block
 block discarded – undo
80 81
 	 */
81 82
 	public function send()
82 83
 	{
83
-		if( !$this->message || !$this->subject || !$this->to )return;
84
+		if( !$this->message || !$this->subject || !$this->to ) {
85
+			return;
86
+		}
84 87
 
85 88
 		$sent = wp_mail(
86 89
 			$this->to,
@@ -209,7 +212,9 @@  discard block
 block discarded – undo
209 212
 		if( !file_exists( $file )) {
210 213
 			$file = sprintf( '%s/templates/email/%s.php', dirname( dirname( __DIR__ )), $templatePath );
211 214
 		}
212
-		if( !file_exists( $file ))return;
215
+		if( !file_exists( $file )) {
216
+			return;
217
+		}
213 218
 
214 219
 		ob_start();
215 220
 		include $file;
Please login to merge, or discard this patch.