Completed
Branch master (344633)
by Paul
02:17
created
src/Facade.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -30,15 +30,15 @@  discard block
 block discarded – undo
30 30
 	 * @return mixed
31 31
 	 * @throws \RuntimeException
32 32
 	 */
33
-	public static function __callStatic( $method, $args )
33
+	public static function __callStatic($method, $args)
34 34
 	{
35 35
 		$instance = static::getFacadeRoot();
36 36
 
37
-		if( !$instance ) {
38
-			throw new RuntimeException( 'A facade root has not been set.' );
37
+		if (!$instance) {
38
+			throw new RuntimeException('A facade root has not been set.');
39 39
 		}
40 40
 
41
-		return $instance->$method( ...$args );
41
+		return $instance->$method(...$args);
42 42
 	}
43 43
 
44 44
 	/**
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 	 */
69 69
 	public static function getFacadeRoot()
70 70
 	{
71
-		return static::resolveFacadeInstance( static::getFacadeAccessor() );
71
+		return static::resolveFacadeInstance(static::getFacadeAccessor());
72 72
 	}
73 73
 
74 74
 	/**
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 	 *
77 77
 	 * @return void
78 78
 	 */
79
-	public static function setFacadeApplication( Application $app )
79
+	public static function setFacadeApplication(Application $app)
80 80
 	{
81 81
 		static::$app = $app;
82 82
 	}
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 	 */
91 91
 	protected static function getFacadeAccessor()
92 92
 	{
93
-		throw new RuntimeException( 'Facade does not implement getFacadeAccessor method.' );
93
+		throw new RuntimeException('Facade does not implement getFacadeAccessor method.');
94 94
 	}
95 95
 
96 96
 	/**
@@ -100,13 +100,13 @@  discard block
 block discarded – undo
100 100
 	 *
101 101
 	 * @return mixed
102 102
 	 */
103
-	protected static function resolveFacadeInstance( $name )
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/Application.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -11,26 +11,26 @@  discard block
 block discarded – undo
11 11
 	public function __construct()
12 12
 	{
13 13
 		Facade::clearResolvedInstances();
14
-		Facade::setFacadeApplication( $this );
14
+		Facade::setFacadeApplication($this);
15 15
 		$this->registerAliases();
16 16
 	}
17 17
 
18 18
 	public function init()
19 19
 	{
20
-		$controller = $this->make( 'Controller' );
20
+		$controller = $this->make('Controller');
21 21
 
22 22
 		// Action hooks
23
-		add_action( 'after_setup_theme',      [$controller, 'afterSetupTheme'], 20 );
24
-		add_action( 'wp_enqueue_scripts',     [$controller, 'registerAssets'] );
25
-		add_action( 'customize_register',     [$controller, 'registerCustomizer'] );
26
-		add_action( 'customize_preview_init', [$controller, 'registerCustomizerAssets'] );
27
-		add_action( 'widgets_init',           [$controller, 'registerSidebars'] );
23
+		add_action('after_setup_theme', [$controller, 'afterSetupTheme'], 20);
24
+		add_action('wp_enqueue_scripts', [$controller, 'registerAssets']);
25
+		add_action('customize_register', [$controller, 'registerCustomizer']);
26
+		add_action('customize_preview_init', [$controller, 'registerCustomizerAssets']);
27
+		add_action('widgets_init', [$controller, 'registerSidebars']);
28 28
 
29 29
 		// Filter hooks
30
-		add_filter( 'template_include',       [$controller, 'filterTemplate'] );
30
+		add_filter('template_include', [$controller, 'filterTemplate']);
31 31
 
32
-		foreach( $this->getTemplateTypes() as $type ) {
33
-			add_filter( "{$type}_template_hierarchy", [$controller, 'filterTemplateHierarchy'] );
32
+		foreach ($this->getTemplateTypes() as $type) {
33
+			add_filter("{$type}_template_hierarchy", [$controller, 'filterTemplateHierarchy']);
34 34
 		}
35 35
 	}
36 36
 
@@ -46,9 +46,9 @@  discard block
 block discarded – undo
46 46
 			'Utility'     => Facades\Utility::class,
47 47
 		];
48 48
 
49
-		$aliases = apply_filters( 'castor/register/aliases', $aliases );
49
+		$aliases = apply_filters('castor/register/aliases', $aliases);
50 50
 
51
-		AliasLoader::getInstance( $aliases )->register();
51
+		AliasLoader::getInstance($aliases)->register();
52 52
 	}
53 53
 
54 54
 	/**
Please login to merge, or discard this patch.
src/Container.php 1 patch
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 	 */
33 33
 	public static function getInstance()
34 34
 	{
35
-		if( is_null( static::$instance )) {
35
+		if (is_null(static::$instance)) {
36 36
 			static::$instance = new static;
37 37
 		}
38 38
 
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 	 *
48 48
 	 * @return mixed
49 49
 	 */
50
-	public function bind( $alias, $concrete )
50
+	public function bind($alias, $concrete)
51 51
 	{
52 52
 		$this->services[$alias] = $concrete;
53 53
 	}
@@ -61,20 +61,20 @@  discard block
 block discarded – undo
61 61
 	 *
62 62
 	 * @return mixed
63 63
 	 */
64
-	public function make( $abstract )
64
+	public function make($abstract)
65 65
 	{
66
-		$service = isset( $this->services[$abstract] )
66
+		$service = isset($this->services[$abstract])
67 67
 			? $this->services[$abstract]
68
-			: $this->addNamespace( $abstract );
68
+			: $this->addNamespace($abstract);
69 69
 
70
-		if( is_callable( $service )) {
71
-			return call_user_func_array( $service, [$this] );
70
+		if (is_callable($service)) {
71
+			return call_user_func_array($service, [$this]);
72 72
 		}
73
-		if( is_object( $service )) {
73
+		if (is_object($service)) {
74 74
 			return $service;
75 75
 		}
76 76
 
77
-		return $this->resolve( $service );
77
+		return $this->resolve($service);
78 78
 	}
79 79
 
80 80
 	/**
@@ -85,9 +85,9 @@  discard block
 block discarded – undo
85 85
 	 *
86 86
 	 * @return void
87 87
 	 */
88
-	public function singleton( $abstract, $concrete )
88
+	public function singleton($abstract, $concrete)
89 89
 	{
90
-		$this->bind( $abstract, $this->make( $concrete ));
90
+		$this->bind($abstract, $this->make($concrete));
91 91
 	}
92 92
 
93 93
 	/**
@@ -97,9 +97,9 @@  discard block
 block discarded – undo
97 97
 	 *
98 98
 	 * @return mixed
99 99
 	 */
100
-	public function __get( $service )
100
+	public function __get($service)
101 101
 	{
102
-		return $this->make( $service );
102
+		return $this->make($service);
103 103
 	}
104 104
 
105 105
 	/**
@@ -110,9 +110,9 @@  discard block
 block discarded – undo
110 110
 	 *
111 111
 	 * @return void
112 112
 	 */
113
-	public function __set( $service, $callback )
113
+	public function __set($service, $callback)
114 114
 	{
115
-		$this->bind( $service, $callback );
115
+		$this->bind($service, $callback);
116 116
 	}
117 117
 
118 118
 	/**
@@ -122,9 +122,9 @@  discard block
 block discarded – undo
122 122
 	 *
123 123
 	 * @return string
124 124
 	 */
125
-	protected function addNamespace( $abstract )
125
+	protected function addNamespace($abstract)
126 126
 	{
127
-		if( strpos( $abstract, __NAMESPACE__ ) === false && !class_exists( $abstract )) {
127
+		if (strpos($abstract, __NAMESPACE__) === false && !class_exists($abstract)) {
128 128
 			$abstract = __NAMESPACE__ . "\\$abstract";
129 129
 		}
130 130
 
@@ -139,11 +139,11 @@  discard block
 block discarded – undo
139 139
 	 * @return void
140 140
 	 * @throws BindingResolutionException
141 141
 	 */
142
-	protected function notInstantiable( $concrete )
142
+	protected function notInstantiable($concrete)
143 143
 	{
144 144
 		$message = "Target [$concrete] is not instantiable.";
145 145
 
146
-		throw new BindingResolutionException( $message );
146
+		throw new BindingResolutionException($message);
147 147
 	}
148 148
 
149 149
 	/**
@@ -154,24 +154,24 @@  discard block
 block discarded – undo
154 154
 	 * @return mixed
155 155
 	 * @throws BindingResolutionException
156 156
 	 */
157
-	protected function resolve( $concrete )
157
+	protected function resolve($concrete)
158 158
 	{
159
-		if( $concrete instanceof Closure ) {
160
-			return $concrete( $this );
159
+		if ($concrete instanceof Closure) {
160
+			return $concrete($this);
161 161
 		}
162 162
 
163
-		$reflector = new ReflectionClass( $concrete );
163
+		$reflector = new ReflectionClass($concrete);
164 164
 
165
-		if( !$reflector->isInstantiable() ) {
166
-			return $this->notInstantiable( $concrete );
165
+		if (!$reflector->isInstantiable()) {
166
+			return $this->notInstantiable($concrete);
167 167
 		}
168 168
 
169
-		if( is_null(( $constructor = $reflector->getConstructor() ))) {
169
+		if (is_null(($constructor = $reflector->getConstructor()))) {
170 170
 			return new $concrete;
171 171
 		}
172 172
 
173 173
 		return $reflector->newInstanceArgs(
174
-			$this->resolveDependencies( $constructor->getParameters() )
174
+			$this->resolveDependencies($constructor->getParameters())
175 175
 		);
176 176
 	}
177 177
 
@@ -181,13 +181,13 @@  discard block
 block discarded – undo
181 181
 	 * @return mixed
182 182
 	 * @throws BindingResolutionException
183 183
 	 */
184
-	protected function resolveClass( ReflectionParameter $parameter )
184
+	protected function resolveClass(ReflectionParameter $parameter)
185 185
 	{
186 186
 		try {
187
-			return $this->make( $parameter->getClass()->name );
187
+			return $this->make($parameter->getClass()->name);
188 188
 		}
189
-		catch( BindingResolutionException $e ) {
190
-			if( $parameter->isOptional() ) {
189
+		catch (BindingResolutionException $e) {
190
+			if ($parameter->isOptional()) {
191 191
 				return $parameter->getDefaultValue();
192 192
 			}
193 193
 			throw $e;
@@ -199,14 +199,14 @@  discard block
 block discarded – undo
199 199
 	 *
200 200
 	 * @return array
201 201
 	 */
202
-	protected function resolveDependencies( array $dependencies )
202
+	protected function resolveDependencies(array $dependencies)
203 203
 	{
204 204
 		$results = [];
205 205
 
206
-		foreach( $dependencies as $dependency ) {
206
+		foreach ($dependencies as $dependency) {
207 207
 			// If the class is null, the dependency is a string or some other primitive type
208
-			$results[] = !is_null( $class = $dependency->getClass() )
209
-				? $this->resolveClass( $dependency )
208
+			$results[] = !is_null($class = $dependency->getClass())
209
+				? $this->resolveClass($dependency)
210 210
 				: null;
211 211
 		}
212 212
 
Please login to merge, or discard this patch.
src/Helpers/Template.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 {
9 9
 	public $util;
10 10
 
11
-	public function __construct( Utility $util )
11
+	public function __construct(Utility $util)
12 12
 	{
13 13
 		$this->util = $util;
14 14
 	}
@@ -24,18 +24,18 @@  discard block
 block discarded – undo
24 24
 	 *
25 25
 	 * @return string
26 26
 	 */
27
-	public function get( $slug, $name = '' )
27
+	public function get($slug, $name = '')
28 28
 	{
29
-		$template  = $this->util->startWith( 'templates/', $slug );
29
+		$template  = $this->util->startWith('templates/', $slug);
30 30
 		$templates = ["{$template}.php"];
31 31
 
32
-		if( 'index' != basename( $this->template, '.php' )) {
33
-			array_unshift( $templates, "{$template}-{$name}.php" );
32
+		if ('index' != basename($this->template, '.php')) {
33
+			array_unshift($templates, "{$template}-{$name}.php");
34 34
 		}
35 35
 
36
-		$templates = apply_filters( "castor/templates/{$slug}", $templates, $name );
36
+		$templates = apply_filters("castor/templates/{$slug}", $templates, $name);
37 37
 
38
-		return locate_template( $templates );
38
+		return locate_template($templates);
39 39
 	}
40 40
 
41 41
 	/**
@@ -44,11 +44,11 @@  discard block
 block discarded – undo
44 44
 	 *
45 45
 	 * @return void
46 46
 	 */
47
-	public function load( $slug, $name = '' )
47
+	public function load($slug, $name = '')
48 48
 	{
49
-		$template = $this->get( $slug, $name );
50
-		if( !empty( $template )) {
51
-			load_template( $template, false );
49
+		$template = $this->get($slug, $name);
50
+		if (!empty($template)) {
51
+			load_template($template, false);
52 52
 		}
53 53
 	}
54 54
 
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 	 */
58 58
 	public function main()
59 59
 	{
60
-		$this->load( $this->template );
60
+		$this->load($this->template);
61 61
 	}
62 62
 
63 63
 	/**
@@ -65,9 +65,9 @@  discard block
 block discarded – undo
65 65
 	 *
66 66
 	 * @return string|void
67 67
 	 */
68
-	public function setLayout( $template )
68
+	public function setLayout($template)
69 69
 	{
70
-		$this->template = $this->util->trimRight( strstr( $template, 'templates/' ), '.php' );
71
-		return $this->get( apply_filters( 'castor/templates/layout', 'layouts/default' ));
70
+		$this->template = $this->util->trimRight(strstr($template, 'templates/'), '.php');
71
+		return $this->get(apply_filters('castor/templates/layout', 'layouts/default'));
72 72
 	}
73 73
 }
Please login to merge, or discard this patch.
src/Helpers/Utility.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -11,9 +11,9 @@  discard block
 block discarded – undo
11 11
 	 *
12 12
 	 * @return string
13 13
 	 */
14
-	public function endWith( $suffix, $string, $unique = true )
14
+	public function endWith($suffix, $string, $unique = true)
15 15
 	{
16
-		return $unique && $this->endsWith( $suffix, $string )
16
+		return $unique && $this->endsWith($suffix, $string)
17 17
 			? $string
18 18
 			: $string . $suffix;
19 19
 	}
@@ -24,11 +24,11 @@  discard block
 block discarded – undo
24 24
 	 *
25 25
 	 * @return string
26 26
 	 */
27
-	public function endsWith( $needle, $haystack )
27
+	public function endsWith($needle, $haystack)
28 28
 	{
29
-		$length = strlen( $needle );
29
+		$length = strlen($needle);
30 30
 		return $length != 0
31
-			? substr( $haystack, -$length ) === $needle
31
+			? substr($haystack, -$length) === $needle
32 32
 			: true;
33 33
 	}
34 34
 
@@ -39,9 +39,9 @@  discard block
 block discarded – undo
39 39
 	 *
40 40
 	 * @return string
41 41
 	 */
42
-	public function startWith( $prefix, $string, $unique = true )
42
+	public function startWith($prefix, $string, $unique = true)
43 43
 	{
44
-		return $unique && $this->startsWith( $prefix, $string )
44
+		return $unique && $this->startsWith($prefix, $string)
45 45
 			? $string
46 46
 			: $prefix . $string;
47 47
 	}
@@ -52,9 +52,9 @@  discard block
 block discarded – undo
52 52
 	 *
53 53
 	 * @return string
54 54
 	 */
55
-	public function startsWith( $needle, $haystack )
55
+	public function startsWith($needle, $haystack)
56 56
 	{
57
-		return substr( $haystack, 0, strlen( $needle )) === $needle;
57
+		return substr($haystack, 0, strlen($needle)) === $needle;
58 58
 	}
59 59
 
60 60
 	/**
@@ -64,11 +64,11 @@  discard block
 block discarded – undo
64 64
 	 *
65 65
 	 * @return string
66 66
 	 */
67
-	public function trimLeft( $string, $needle, $caseSensitive = true )
67
+	public function trimLeft($string, $needle, $caseSensitive = true)
68 68
 	{
69 69
 		$strPos = $caseSensitive ? "strpos" : "stripos";
70
-		if( $strPos( $string, $needle ) === 0 ) {
71
-			$string = substr( $string, strlen( $needle ));
70
+		if ($strPos($string, $needle) === 0) {
71
+			$string = substr($string, strlen($needle));
72 72
 		}
73 73
 		return $string;
74 74
 	}
@@ -80,11 +80,11 @@  discard block
 block discarded – undo
80 80
 	 *
81 81
 	 * @return string
82 82
 	 */
83
-	public function trimRight( $string, $needle, $caseSensitive = true )
83
+	public function trimRight($string, $needle, $caseSensitive = true)
84 84
 	{
85 85
 		$strPos = $caseSensitive ? "strpos" : "stripos";
86
-		if( $strPos( $string, $needle, strlen( $string ) - strlen( $needle )) !== false ) {
87
-			$string = substr( $string, 0, -strlen( $needle ));
86
+		if ($strPos($string, $needle, strlen($string) - strlen($needle)) !== false) {
87
+			$string = substr($string, 0, -strlen($needle));
88 88
 		}
89 89
 		return $string;
90 90
 	}
Please login to merge, or discard this patch.
src/Helpers/Theme.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -9,9 +9,9 @@  discard block
 block discarded – undo
9 9
 	 *
10 10
 	 * @return string
11 11
 	 */
12
-	public function assetPath( $asset )
12
+	public function assetPath($asset)
13 13
 	{
14
-		return $this->paths( 'dir.stylesheet' ) . 'assets/' . $asset;
14
+		return $this->paths('dir.stylesheet') . 'assets/' . $asset;
15 15
 	}
16 16
 
17 17
 	/**
@@ -19,9 +19,9 @@  discard block
 block discarded – undo
19 19
 	 *
20 20
 	 * @return string
21 21
 	 */
22
-	public function assetUri( $asset )
22
+	public function assetUri($asset)
23 23
 	{
24
-		return $this->paths( 'uri.stylesheet' ) . 'assets/' . $asset;
24
+		return $this->paths('uri.stylesheet') . 'assets/' . $asset;
25 25
 	}
26 26
 
27 27
 	/**
@@ -35,9 +35,9 @@  discard block
 block discarded – undo
35 35
 			is_single(),
36 36
 		];
37 37
 
38
-		$display = in_array( true, $conditions );
38
+		$display = in_array(true, $conditions);
39 39
 
40
-		return apply_filters( 'castor/display/sidebar', $display );
40
+		return apply_filters('castor/display/sidebar', $display);
41 41
 	}
42 42
 
43 43
 	/**
@@ -45,9 +45,9 @@  discard block
 block discarded – undo
45 45
 	 *
46 46
 	 * @return string
47 47
 	 */
48
-	public function imagePath( $asset )
48
+	public function imagePath($asset)
49 49
 	{
50
-		return $this->paths( 'dir.stylesheet' ) . 'assets/img/' . $asset;
50
+		return $this->paths('dir.stylesheet') . 'assets/img/' . $asset;
51 51
 	}
52 52
 
53 53
 	/**
@@ -55,16 +55,16 @@  discard block
 block discarded – undo
55 55
 	 *
56 56
 	 * @return string
57 57
 	 */
58
-	public function imageUri( $asset )
58
+	public function imageUri($asset)
59 59
 	{
60
-		return $this->paths( 'uri.stylesheet' ) . 'assets/img/' . $asset;
60
+		return $this->paths('uri.stylesheet') . 'assets/img/' . $asset;
61 61
 	}
62 62
 
63 63
 	public function pageTitle()
64 64
 	{
65
-		foreach( ['is_404', 'is_archive', 'is_home', 'is_search'] as $bool ) {
66
-			if( !$bool() )continue;
67
-			$method = sprintf( 'get%sTitle', ucfirst( str_replace( 'is_', '', $bool )));
65
+		foreach (['is_404', 'is_archive', 'is_home', 'is_search'] as $bool) {
66
+			if (!$bool())continue;
67
+			$method = sprintf('get%sTitle', ucfirst(str_replace('is_', '', $bool)));
68 68
 			return $this->$method();
69 69
 		}
70 70
 		return get_the_title();
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 	 *
76 76
 	 * @return array|string
77 77
 	 */
78
-	public function paths( $path = null )
78
+	public function paths($path = null)
79 79
 	{
80 80
 		$paths = [
81 81
 			'dir.stylesheet' => get_stylesheet_directory(),
@@ -85,18 +85,18 @@  discard block
 block discarded – undo
85 85
 			'uri.template'   => get_template_directory_uri(),
86 86
 		];
87 87
 
88
-		if( is_null( $path )) {
88
+		if (is_null($path)) {
89 89
 			return $paths;
90 90
 		}
91 91
 
92
-		return array_key_exists( $path, $paths )
93
-			? trailingslashit( $paths[$path] )
92
+		return array_key_exists($path, $paths)
93
+			? trailingslashit($paths[$path])
94 94
 			: '';
95 95
 	}
96 96
 
97 97
 	protected function get404Title()
98 98
 	{
99
-		return __( 'Not Found', 'castor' );
99
+		return __('Not Found', 'castor');
100 100
 	}
101 101
 
102 102
 	protected function getArchiveTitle()
@@ -106,13 +106,13 @@  discard block
 block discarded – undo
106 106
 
107 107
 	protected function getHomeTitle()
108 108
 	{
109
-		return ( $home = get_option( 'page_for_posts', true ))
110
-			? get_the_title( $home )
111
-			: __( 'Latest Posts', 'castor' );
109
+		return ($home = get_option('page_for_posts', true))
110
+			? get_the_title($home)
111
+			: __('Latest Posts', 'castor');
112 112
 	}
113 113
 
114 114
 	protected function getSearchTitle()
115 115
 	{
116
-		return sprintf( __( 'Search Results for %s', 'castor' ), get_search_query() );
116
+		return sprintf(__('Search Results for %s', 'castor'), get_search_query());
117 117
 	}
118 118
 }
Please login to merge, or discard this patch.
src/Helpers/Development.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -9,25 +9,25 @@  discard block
 block discarded – undo
9 9
 	public function capture()
10 10
 	{
11 11
 		ob_start();
12
-		call_user_func_array( [$this, 'print'], func_get_args() );
12
+		call_user_func_array([$this, 'print'], func_get_args());
13 13
 		return ob_get_clean();
14 14
 	}
15 15
 
16 16
 	public function className()
17 17
 	{
18
-		return $this->isDev() && in_array( DEV, ['css', true] )
18
+		return $this->isDev() && in_array(DEV, ['css', true])
19 19
 			? 'dev'
20 20
 			: '';
21 21
 	}
22 22
 
23
-	public function debug( $value )
23
+	public function debug($value)
24 24
 	{
25
-		$this->print( $value );
25
+		$this->print($value);
26 26
 	}
27 27
 
28 28
 	public function isDev()
29 29
 	{
30
-		return defined( 'DEV' ) && !!DEV && WP_ENV == 'development';
30
+		return defined('DEV') && !!DEV && WP_ENV == 'development';
31 31
 	}
32 32
 
33 33
 	public function isProduction()
@@ -35,48 +35,48 @@  discard block
 block discarded – undo
35 35
 		return WP_ENV == 'production';
36 36
 	}
37 37
 
38
-	public function print( $value )
38
+	public function print($value)
39 39
 	{
40 40
 		$args = func_num_args();
41 41
 
42
-		if( $args == 1 ) {
43
-			printf( '<div class="print__r"><pre>%s</pre></div>',
44
-				htmlspecialchars( print_r( $value, true ), ENT_QUOTES, 'UTF-8' )
42
+		if ($args == 1) {
43
+			printf('<div class="print__r"><pre>%s</pre></div>',
44
+				htmlspecialchars(print_r($value, true), ENT_QUOTES, 'UTF-8')
45 45
 			);
46 46
 		}
47
-		else if( $args > 1 ) {
47
+		else if ($args > 1) {
48 48
 			echo '<div class="print__r_group">';
49
-			foreach( func_get_args() as $param ) {
50
-				$this->print( $param );
49
+			foreach (func_get_args() as $param) {
50
+				$this->print($param);
51 51
 			}
52 52
 			echo '</div>';
53 53
 		}
54 54
 	}
55 55
 
56
-	public function printFiltersFor( $hook = '' )
56
+	public function printFiltersFor($hook = '')
57 57
 	{
58 58
 		global $wp_filter;
59
-		if( empty( $hook ) || !isset( $wp_filter[$hook] ))return;
60
-		$this->print( $wp_filter[ $hook ] );
59
+		if (empty($hook) || !isset($wp_filter[$hook]))return;
60
+		$this->print($wp_filter[$hook]);
61 61
 	}
62 62
 
63 63
 	public function printTemplatePaths()
64 64
 	{
65
-		if( $this->isDev() && ( DEV == 'templates' || DEV === true )) {
66
-			$templates = array_keys( array_flip( $this->templatePaths ));
67
-			$templates = array_map( function( $key, $value ) {
68
-				return sprintf( '[%s] => %s', $key, $value );
69
-			}, array_keys( $templates ), $templates );
65
+		if ($this->isDev() && (DEV == 'templates' || DEV === true)) {
66
+			$templates = array_keys(array_flip($this->templatePaths));
67
+			$templates = array_map(function($key, $value) {
68
+				return sprintf('[%s] => %s', $key, $value);
69
+			}, array_keys($templates), $templates);
70 70
 
71
-			$this->print( implode( "\n", $templates ));
71
+			$this->print(implode("\n", $templates));
72 72
 		}
73 73
 	}
74 74
 
75
-	public function storeTemplatePath( $template )
75
+	public function storeTemplatePath($template)
76 76
 	{
77
-		if( is_string( $template )) {
78
-			$themeName = basename( strstr( $template, '/templates/', true ));
79
-			$this->templatePaths[] = $themeName . strstr( $template, '/templates/' );
77
+		if (is_string($template)) {
78
+			$themeName = basename(strstr($template, '/templates/', true));
79
+			$this->templatePaths[] = $themeName . strstr($template, '/templates/');
80 80
 		}
81 81
 	}
82 82
 }
Please login to merge, or discard this patch.
src/Controller.php 1 patch
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -12,29 +12,29 @@  discard block
 block discarded – undo
12 12
 {
13 13
 	public function afterSetupTheme()
14 14
 	{
15
-		add_theme_support( 'customize-selective-refresh-widgets' );
16
-		add_theme_support( 'html5', ['caption', 'comment-form', 'comment-list', 'gallery', 'search-form'] );
17
-		add_theme_support( 'post-thumbnails' );
18
-		add_theme_support( 'soil-clean-up' );
19
-		add_theme_support( 'soil-jquery-cdn' );
20
-		add_theme_support( 'soil-nav-walker' );
21
-		add_theme_support( 'soil-nice-search' );
22
-		add_theme_support( 'soil-relative-urls' );
23
-		add_theme_support( 'title-tag' );
24
-		add_editor_style( Theme::assetUri( 'css/editor.css' ));
25
-		load_theme_textdomain( 'castor', Theme::paths( 'dir.template' ) . '/languages' );
26
-		register_nav_menu( 'main_menu', __( 'Main Menu', 'castor' ));
15
+		add_theme_support('customize-selective-refresh-widgets');
16
+		add_theme_support('html5', ['caption', 'comment-form', 'comment-list', 'gallery', 'search-form']);
17
+		add_theme_support('post-thumbnails');
18
+		add_theme_support('soil-clean-up');
19
+		add_theme_support('soil-jquery-cdn');
20
+		add_theme_support('soil-nav-walker');
21
+		add_theme_support('soil-nice-search');
22
+		add_theme_support('soil-relative-urls');
23
+		add_theme_support('title-tag');
24
+		add_editor_style(Theme::assetUri('css/editor.css'));
25
+		load_theme_textdomain('castor', Theme::paths('dir.template') . '/languages');
26
+		register_nav_menu('main_menu', __('Main Menu', 'castor'));
27 27
 	}
28 28
 
29 29
 	/**
30 30
 	 * @return string
31 31
 	 * @filter template_include
32 32
 	 */
33
-	public function filterTemplate( $template )
33
+	public function filterTemplate($template)
34 34
 	{
35
-		if( is_string( $template )) {
36
-			$template = Template::setLayout( $template );
37
-			Development::storeTemplatePath( $template );
35
+		if (is_string($template)) {
36
+			$template = Template::setLayout($template);
37
+			Development::storeTemplatePath($template);
38 38
 		}
39 39
 		return $template;
40 40
 	}
@@ -43,33 +43,33 @@  discard block
 block discarded – undo
43 43
 	 * @return array
44 44
 	 * @filter {$type}_template_hierarchy
45 45
 	 */
46
-	public function filterTemplateHierarchy( array $templates )
46
+	public function filterTemplateHierarchy(array $templates)
47 47
 	{
48
-		return array_map( function( $template ) {
49
-			return Utility::startWith( 'templates/', $template );
50
-		}, $templates );
48
+		return array_map(function($template) {
49
+			return Utility::startWith('templates/', $template);
50
+		}, $templates);
51 51
 	}
52 52
 
53 53
 	public function registerAssets()
54 54
 	{
55
-		wp_enqueue_style( 'castor/main.css', Theme::assetUri( 'css/main.css' ), [], null );
56
-		wp_enqueue_script( 'castor/main.js', Theme::assetUri( 'js/main.js' ), [], null, true );
55
+		wp_enqueue_style('castor/main.css', Theme::assetUri('css/main.css'), [], null);
56
+		wp_enqueue_script('castor/main.js', Theme::assetUri('js/main.js'), [], null, true);
57 57
 	}
58 58
 
59
-	public function registerCustomizer( WP_Customize_Manager $manager )
59
+	public function registerCustomizer(WP_Customize_Manager $manager)
60 60
 	{
61
-		$manager->get_setting( 'blogname' )->transport = 'postMessage';
62
-		$manager->selective_refresh->add_partial( 'blogname', [
61
+		$manager->get_setting('blogname')->transport = 'postMessage';
62
+		$manager->selective_refresh->add_partial('blogname', [
63 63
 			'selector'        => '.brand',
64 64
 			'render_callback' => function() {
65
-				bloginfo( 'name' );
65
+				bloginfo('name');
66 66
 			},
67 67
 		]);
68 68
 	}
69 69
 
70 70
 	public function registerCustomizerAssets()
71 71
 	{
72
-		wp_enqueue_script( 'castor/customizer.js', Theme::assetUri( 'js/customizer.js' ), ['customize-preview'], null, true );
72
+		wp_enqueue_script('castor/customizer.js', Theme::assetUri('js/customizer.js'), ['customize-preview'], null, true);
73 73
 	}
74 74
 
75 75
 	public function registerSidebars()
@@ -83,12 +83,12 @@  discard block
 block discarded – undo
83 83
 
84 84
 		register_sidebar([
85 85
 			'id'   => 'sidebar-primary',
86
-			'name' => __( 'Primary Sidebar', 'castor' ),
87
-		] + $defaults );
86
+			'name' => __('Primary Sidebar', 'castor'),
87
+		] + $defaults);
88 88
 
89 89
 		register_sidebar([
90 90
 			'id'   => 'sidebar-footer',
91
-			'name' => __( 'Footer Sidebar', 'castor' ),
92
-		] + $defaults );
91
+			'name' => __('Footer Sidebar', 'castor'),
92
+		] + $defaults);
93 93
 	}
94 94
 }
Please login to merge, or discard this patch.
src/AliasLoader.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 	 */
26 26
 	protected $registered = false;
27 27
 
28
-	private function __construct( array $aliases )
28
+	private function __construct(array $aliases)
29 29
 	{
30 30
 		$this->aliases = $aliases;
31 31
 	}
@@ -38,13 +38,13 @@  discard block
 block discarded – undo
38 38
 	 *
39 39
 	 * @return AliasLoader
40 40
 	 */
41
-	public static function getInstance( array $aliases = [] )
41
+	public static function getInstance(array $aliases = [])
42 42
 	{
43
-		if( is_null( static::$instance )) {
44
-			return static::$instance = new static( $aliases );
43
+		if (is_null(static::$instance)) {
44
+			return static::$instance = new static($aliases);
45 45
 		}
46 46
 
47
-		$aliases = array_merge( static::$instance->aliases, $aliases );
47
+		$aliases = array_merge(static::$instance->aliases, $aliases);
48 48
 
49 49
 		static::$instance->aliases = $aliases;
50 50
 
@@ -58,10 +58,10 @@  discard block
 block discarded – undo
58 58
 	 *
59 59
 	 * @return bool|null
60 60
 	 */
61
-	public function load( $alias )
61
+	public function load($alias)
62 62
 	{
63
-		if( isset( $this->aliases[$alias] )) {
64
-			return class_alias( $this->aliases[$alias], $alias );
63
+		if (isset($this->aliases[$alias])) {
64
+			return class_alias($this->aliases[$alias], $alias);
65 65
 		}
66 66
 	}
67 67
 
@@ -72,8 +72,8 @@  discard block
 block discarded – undo
72 72
 	 */
73 73
 	public function register()
74 74
 	{
75
-		if( !$this->registered ) {
76
-			spl_autoload_register( [$this, 'load'], true, true );
75
+		if (!$this->registered) {
76
+			spl_autoload_register([$this, 'load'], true, true);
77 77
 			$this->registered = true;
78 78
 		}
79 79
 	}
Please login to merge, or discard this patch.