@@ -6,13 +6,13 @@ |
||
6 | 6 | |
7 | 7 | class Template extends Facade |
8 | 8 | { |
9 | - /** |
|
10 | - * Get the fully qualified class name of the component. |
|
11 | - * |
|
12 | - * @return string |
|
13 | - */ |
|
14 | - protected static function getFacadeAccessor() |
|
15 | - { |
|
16 | - return \GeminiLabs\Castor\Helpers\Template::class; |
|
17 | - } |
|
9 | + /** |
|
10 | + * Get the fully qualified class name of the component. |
|
11 | + * |
|
12 | + * @return string |
|
13 | + */ |
|
14 | + protected static function getFacadeAccessor() |
|
15 | + { |
|
16 | + return \GeminiLabs\Castor\Helpers\Template::class; |
|
17 | + } |
|
18 | 18 | } |
@@ -6,13 +6,13 @@ |
||
6 | 6 | |
7 | 7 | class Utility extends Facade |
8 | 8 | { |
9 | - /** |
|
10 | - * Get the fully qualified class name of the component. |
|
11 | - * |
|
12 | - * @return string |
|
13 | - */ |
|
14 | - protected static function getFacadeAccessor() |
|
15 | - { |
|
16 | - return \GeminiLabs\Castor\Helpers\Utility::class; |
|
17 | - } |
|
9 | + /** |
|
10 | + * Get the fully qualified class name of the component. |
|
11 | + * |
|
12 | + * @return string |
|
13 | + */ |
|
14 | + protected static function getFacadeAccessor() |
|
15 | + { |
|
16 | + return \GeminiLabs\Castor\Helpers\Utility::class; |
|
17 | + } |
|
18 | 18 | } |
@@ -6,13 +6,13 @@ |
||
6 | 6 | |
7 | 7 | class Theme extends Facade |
8 | 8 | { |
9 | - /** |
|
10 | - * Get the fully qualified class name of the component. |
|
11 | - * |
|
12 | - * @return string |
|
13 | - */ |
|
14 | - protected static function getFacadeAccessor() |
|
15 | - { |
|
16 | - return \GeminiLabs\Castor\Helpers\Theme::class; |
|
17 | - } |
|
9 | + /** |
|
10 | + * Get the fully qualified class name of the component. |
|
11 | + * |
|
12 | + * @return string |
|
13 | + */ |
|
14 | + protected static function getFacadeAccessor() |
|
15 | + { |
|
16 | + return \GeminiLabs\Castor\Helpers\Theme::class; |
|
17 | + } |
|
18 | 18 | } |
@@ -6,13 +6,13 @@ |
||
6 | 6 | |
7 | 7 | class Development extends Facade |
8 | 8 | { |
9 | - /** |
|
10 | - * Get the fully qualified class name of the component. |
|
11 | - * |
|
12 | - * @return string |
|
13 | - */ |
|
14 | - protected static function getFacadeAccessor() |
|
15 | - { |
|
16 | - return \GeminiLabs\Castor\Helpers\Development::class; |
|
17 | - } |
|
9 | + /** |
|
10 | + * Get the fully qualified class name of the component. |
|
11 | + * |
|
12 | + * @return string |
|
13 | + */ |
|
14 | + protected static function getFacadeAccessor() |
|
15 | + { |
|
16 | + return \GeminiLabs\Castor\Helpers\Development::class; |
|
17 | + } |
|
18 | 18 | } |
@@ -185,8 +185,7 @@ |
||
185 | 185 | { |
186 | 186 | try { |
187 | 187 | return $this->make( $parameter->getClass()->name ); |
188 | - } |
|
189 | - catch( BindingResolutionException $e ) { |
|
188 | + } catch( BindingResolutionException $e ) { |
|
190 | 189 | if( $parameter->isOptional() ) { |
191 | 190 | return $parameter->getDefaultValue(); |
192 | 191 | } |
@@ -18,18 +18,18 @@ |
||
18 | 18 | */ |
19 | 19 | protected static $instance; |
20 | 20 | |
21 | - /** |
|
22 | - * The container's bound services. |
|
23 | - * |
|
24 | - * @var array |
|
25 | - */ |
|
21 | + /** |
|
22 | + * The container's bound services. |
|
23 | + * |
|
24 | + * @var array |
|
25 | + */ |
|
26 | 26 | protected $services = []; |
27 | 27 | |
28 | - /** |
|
29 | - * The container's bucket items |
|
30 | - * |
|
31 | - * @var array |
|
32 | - */ |
|
28 | + /** |
|
29 | + * The container's bucket items |
|
30 | + * |
|
31 | + * @var array |
|
32 | + */ |
|
33 | 33 | protected $bucket = []; |
34 | 34 | |
35 | 35 | /** |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | */ |
40 | 40 | public static function getInstance() |
41 | 41 | { |
42 | - if( is_null( static::$instance )) { |
|
42 | + if (is_null(static::$instance)) { |
|
43 | 43 | static::$instance = new static; |
44 | 44 | } |
45 | 45 | |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | * |
55 | 55 | * @return mixed |
56 | 56 | */ |
57 | - public function bind( $alias, $concrete ) |
|
57 | + public function bind($alias, $concrete) |
|
58 | 58 | { |
59 | 59 | $this->services[$alias] = $concrete; |
60 | 60 | } |
@@ -68,20 +68,20 @@ discard block |
||
68 | 68 | * |
69 | 69 | * @return mixed |
70 | 70 | */ |
71 | - public function make( $abstract ) |
|
71 | + public function make($abstract) |
|
72 | 72 | { |
73 | - $service = isset( $this->services[$abstract] ) |
|
73 | + $service = isset($this->services[$abstract]) |
|
74 | 74 | ? $this->services[$abstract] |
75 | - : $this->addNamespace( $abstract ); |
|
75 | + : $this->addNamespace($abstract); |
|
76 | 76 | |
77 | - if( is_callable( $service )) { |
|
78 | - return call_user_func_array( $service, [$this] ); |
|
77 | + if (is_callable($service)) { |
|
78 | + return call_user_func_array($service, [$this]); |
|
79 | 79 | } |
80 | - if( is_object( $service )) { |
|
80 | + if (is_object($service)) { |
|
81 | 81 | return $service; |
82 | 82 | } |
83 | 83 | |
84 | - return $this->resolve( $service ); |
|
84 | + return $this->resolve($service); |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | /** |
@@ -92,9 +92,9 @@ discard block |
||
92 | 92 | * |
93 | 93 | * @return void |
94 | 94 | */ |
95 | - public function singleton( $abstract, $concrete ) |
|
95 | + public function singleton($abstract, $concrete) |
|
96 | 96 | { |
97 | - $this->bind( $abstract, $this->make( $concrete )); |
|
97 | + $this->bind($abstract, $this->make($concrete)); |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | /** |
@@ -104,9 +104,9 @@ discard block |
||
104 | 104 | * |
105 | 105 | * @return mixed |
106 | 106 | */ |
107 | - public function __get( $item ) |
|
107 | + public function __get($item) |
|
108 | 108 | { |
109 | - return isset( $this->bucket[$item] ) |
|
109 | + return isset($this->bucket[$item]) |
|
110 | 110 | ? $this->bucket[$item] |
111 | 111 | : null; |
112 | 112 | } |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | * |
120 | 120 | * @return void |
121 | 121 | */ |
122 | - public function __set( $item, $value ) |
|
122 | + public function __set($item, $value) |
|
123 | 123 | { |
124 | 124 | $this->bucket[$item] = $value; |
125 | 125 | } |
@@ -131,9 +131,9 @@ discard block |
||
131 | 131 | * |
132 | 132 | * @return string |
133 | 133 | */ |
134 | - protected function addNamespace( $abstract ) |
|
134 | + protected function addNamespace($abstract) |
|
135 | 135 | { |
136 | - if( strpos( $abstract, __NAMESPACE__ ) === false && !class_exists( $abstract )) { |
|
136 | + if (strpos($abstract, __NAMESPACE__) === false && !class_exists($abstract)) { |
|
137 | 137 | $abstract = __NAMESPACE__ . "\\$abstract"; |
138 | 138 | } |
139 | 139 | |
@@ -148,11 +148,11 @@ discard block |
||
148 | 148 | * @return void |
149 | 149 | * @throws BindingResolutionException |
150 | 150 | */ |
151 | - protected function notInstantiable( $concrete ) |
|
151 | + protected function notInstantiable($concrete) |
|
152 | 152 | { |
153 | 153 | $message = "Target [$concrete] is not instantiable."; |
154 | 154 | |
155 | - throw new BindingResolutionException( $message ); |
|
155 | + throw new BindingResolutionException($message); |
|
156 | 156 | } |
157 | 157 | |
158 | 158 | /** |
@@ -163,24 +163,24 @@ discard block |
||
163 | 163 | * @return mixed |
164 | 164 | * @throws BindingResolutionException |
165 | 165 | */ |
166 | - protected function resolve( $concrete ) |
|
166 | + protected function resolve($concrete) |
|
167 | 167 | { |
168 | - if( $concrete instanceof Closure ) { |
|
169 | - return $concrete( $this ); |
|
168 | + if ($concrete instanceof Closure) { |
|
169 | + return $concrete($this); |
|
170 | 170 | } |
171 | 171 | |
172 | - $reflector = new ReflectionClass( $concrete ); |
|
172 | + $reflector = new ReflectionClass($concrete); |
|
173 | 173 | |
174 | - if( !$reflector->isInstantiable() ) { |
|
175 | - return $this->notInstantiable( $concrete ); |
|
174 | + if (!$reflector->isInstantiable()) { |
|
175 | + return $this->notInstantiable($concrete); |
|
176 | 176 | } |
177 | 177 | |
178 | - if( is_null(( $constructor = $reflector->getConstructor() ))) { |
|
178 | + if (is_null(($constructor = $reflector->getConstructor()))) { |
|
179 | 179 | return new $concrete; |
180 | 180 | } |
181 | 181 | |
182 | 182 | return $reflector->newInstanceArgs( |
183 | - $this->resolveDependencies( $constructor->getParameters() ) |
|
183 | + $this->resolveDependencies($constructor->getParameters()) |
|
184 | 184 | ); |
185 | 185 | } |
186 | 186 | |
@@ -190,13 +190,13 @@ discard block |
||
190 | 190 | * @return mixed |
191 | 191 | * @throws BindingResolutionException |
192 | 192 | */ |
193 | - protected function resolveClass( ReflectionParameter $parameter ) |
|
193 | + protected function resolveClass(ReflectionParameter $parameter) |
|
194 | 194 | { |
195 | 195 | try { |
196 | - return $this->make( $parameter->getClass()->name ); |
|
196 | + return $this->make($parameter->getClass()->name); |
|
197 | 197 | } |
198 | - catch( BindingResolutionException $e ) { |
|
199 | - if( $parameter->isOptional() ) { |
|
198 | + catch (BindingResolutionException $e) { |
|
199 | + if ($parameter->isOptional()) { |
|
200 | 200 | return $parameter->getDefaultValue(); |
201 | 201 | } |
202 | 202 | throw $e; |
@@ -208,14 +208,14 @@ discard block |
||
208 | 208 | * |
209 | 209 | * @return array |
210 | 210 | */ |
211 | - protected function resolveDependencies( array $dependencies ) |
|
211 | + protected function resolveDependencies(array $dependencies) |
|
212 | 212 | { |
213 | 213 | $results = []; |
214 | 214 | |
215 | - foreach( $dependencies as $dependency ) { |
|
215 | + foreach ($dependencies as $dependency) { |
|
216 | 216 | // If the class is null, the dependency is a string or some other primitive type |
217 | - $results[] = !is_null( $class = $dependency->getClass() ) |
|
218 | - ? $this->resolveClass( $dependency ) |
|
217 | + $results[] = !is_null($class = $dependency->getClass()) |
|
218 | + ? $this->resolveClass($dependency) |
|
219 | 219 | : null; |
220 | 220 | } |
221 | 221 |
@@ -25,7 +25,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 | } |
@@ -72,7 +72,9 @@ |
||
72 | 72 | public function pageTitle() |
73 | 73 | { |
74 | 74 | foreach( ['is_404', 'is_archive', 'is_home', 'is_page', 'is_search'] as $bool ) { |
75 | - if( !$bool() )continue; |
|
75 | + if( !$bool() ) { |
|
76 | + continue; |
|
77 | + } |
|
76 | 78 | $method = sprintf( 'get%sTitle', ucfirst( str_replace( 'is_', '', $bool ))); |
77 | 79 | return $this->$method(); |
78 | 80 | } |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | public $archiveMeta; |
10 | 10 | public $postMeta; |
11 | 11 | |
12 | - public function __construct( ArchiveMeta $archiveMeta, PostMeta $postMeta ) |
|
12 | + public function __construct(ArchiveMeta $archiveMeta, PostMeta $postMeta) |
|
13 | 13 | { |
14 | 14 | $this->archiveMeta = $archiveMeta; |
15 | 15 | $this->postMeta = $postMeta; |
@@ -20,9 +20,9 @@ discard block |
||
20 | 20 | * |
21 | 21 | * @return string |
22 | 22 | */ |
23 | - public function assetPath( $asset ) |
|
23 | + public function assetPath($asset) |
|
24 | 24 | { |
25 | - return $this->paths( 'dir.stylesheet' ) . 'assets/' . $asset; |
|
25 | + return $this->paths('dir.stylesheet') . 'assets/' . $asset; |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | /** |
@@ -30,9 +30,9 @@ discard block |
||
30 | 30 | * |
31 | 31 | * @return string |
32 | 32 | */ |
33 | - public function assetUri( $asset ) |
|
33 | + public function assetUri($asset) |
|
34 | 34 | { |
35 | - return $this->paths( 'uri.stylesheet' ) . 'assets/' . $asset; |
|
35 | + return $this->paths('uri.stylesheet') . 'assets/' . $asset; |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | /** |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | */ |
41 | 41 | public function copyright() |
42 | 42 | { |
43 | - return __( 'Copyright', 'castor' ) . ' © ' . date( 'Y' ) . ', ' . get_bloginfo( 'name' ); |
|
43 | + return __('Copyright', 'castor') . ' © ' . date('Y') . ', ' . get_bloginfo('name'); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | /** |
@@ -54,9 +54,9 @@ discard block |
||
54 | 54 | is_single(), |
55 | 55 | ]; |
56 | 56 | |
57 | - $display = in_array( true, $conditions ); |
|
57 | + $display = in_array(true, $conditions); |
|
58 | 58 | |
59 | - return apply_filters( 'castor/display/sidebar', $display ); |
|
59 | + return apply_filters('castor/display/sidebar', $display); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | /** |
@@ -64,9 +64,9 @@ discard block |
||
64 | 64 | * |
65 | 65 | * @return string |
66 | 66 | */ |
67 | - public function imagePath( $asset ) |
|
67 | + public function imagePath($asset) |
|
68 | 68 | { |
69 | - return $this->paths( 'dir.stylesheet' ) . 'assets/img/' . $asset; |
|
69 | + return $this->paths('dir.stylesheet') . 'assets/img/' . $asset; |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | /** |
@@ -74,16 +74,16 @@ discard block |
||
74 | 74 | * |
75 | 75 | * @return string |
76 | 76 | */ |
77 | - public function imageUri( $asset ) |
|
77 | + public function imageUri($asset) |
|
78 | 78 | { |
79 | - return $this->paths( 'uri.stylesheet' ) . 'assets/img/' . $asset; |
|
79 | + return $this->paths('uri.stylesheet') . 'assets/img/' . $asset; |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | public function pageTitle() |
83 | 83 | { |
84 | - foreach( ['is_404', 'is_archive', 'is_home', 'is_page', 'is_search'] as $bool ) { |
|
85 | - if( !$bool() )continue; |
|
86 | - $method = sprintf( 'get%sTitle', ucfirst( str_replace( 'is_', '', $bool ))); |
|
84 | + foreach (['is_404', 'is_archive', 'is_home', 'is_page', 'is_search'] as $bool) { |
|
85 | + if (!$bool())continue; |
|
86 | + $method = sprintf('get%sTitle', ucfirst(str_replace('is_', '', $bool))); |
|
87 | 87 | return $this->$method(); |
88 | 88 | } |
89 | 89 | |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | * |
96 | 96 | * @return array|string |
97 | 97 | */ |
98 | - public function paths( $path = null ) |
|
98 | + public function paths($path = null) |
|
99 | 99 | { |
100 | 100 | $paths = [ |
101 | 101 | 'dir.stylesheet' => get_stylesheet_directory(), |
@@ -105,12 +105,12 @@ discard block |
||
105 | 105 | 'uri.template' => get_template_directory_uri(), |
106 | 106 | ]; |
107 | 107 | |
108 | - if( is_null( $path )) { |
|
108 | + if (is_null($path)) { |
|
109 | 109 | return $paths; |
110 | 110 | } |
111 | 111 | |
112 | - return array_key_exists( $path, $paths ) |
|
113 | - ? trailingslashit( $paths[$path] ) |
|
112 | + return array_key_exists($path, $paths) |
|
113 | + ? trailingslashit($paths[$path]) |
|
114 | 114 | : ''; |
115 | 115 | } |
116 | 116 | |
@@ -119,39 +119,39 @@ discard block |
||
119 | 119 | * |
120 | 120 | * @return string|null |
121 | 121 | */ |
122 | - public function svg( $path = null ) |
|
122 | + public function svg($path = null) |
|
123 | 123 | { |
124 | - if( file_exists( $this->imagePath( $path ))) { |
|
125 | - return file_get_contents( $this->imagePath( $path )); |
|
124 | + if (file_exists($this->imagePath($path))) { |
|
125 | + return file_get_contents($this->imagePath($path)); |
|
126 | 126 | } |
127 | 127 | } |
128 | 128 | |
129 | 129 | protected function get404Title() |
130 | 130 | { |
131 | - return __( 'Not Found', 'castor' ); |
|
131 | + return __('Not Found', 'castor'); |
|
132 | 132 | } |
133 | 133 | |
134 | 134 | protected function getArchiveTitle() |
135 | 135 | { |
136 | - return $this->archiveMeta->get( 'title', get_the_archive_title(), get_query_var( 'post_type' )); |
|
136 | + return $this->archiveMeta->get('title', get_the_archive_title(), get_query_var('post_type')); |
|
137 | 137 | } |
138 | 138 | |
139 | 139 | protected function getHomeTitle() |
140 | 140 | { |
141 | - return ( $home = get_option( 'page_for_posts', true )) |
|
142 | - ? get_the_title( $home ) |
|
143 | - : __( 'Latest Posts', 'castor' ); |
|
141 | + return ($home = get_option('page_for_posts', true)) |
|
142 | + ? get_the_title($home) |
|
143 | + : __('Latest Posts', 'castor'); |
|
144 | 144 | } |
145 | 145 | |
146 | 146 | protected function getPageTitle() |
147 | 147 | { |
148 | - return $this->postMeta->get( 'title', [ |
|
148 | + return $this->postMeta->get('title', [ |
|
149 | 149 | 'fallback' => get_the_title(), |
150 | 150 | ]); |
151 | 151 | } |
152 | 152 | |
153 | 153 | protected function getSearchTitle() |
154 | 154 | { |
155 | - return sprintf( __( 'Search Results for %s', 'castor' ), get_search_query() ); |
|
155 | + return sprintf(__('Search Results for %s', 'castor'), get_search_query()); |
|
156 | 156 | } |
157 | 157 | } |
@@ -6,13 +6,13 @@ |
||
6 | 6 | |
7 | 7 | class PostMeta extends Facade |
8 | 8 | { |
9 | - /** |
|
10 | - * Get the fully qualified class name of the component. |
|
11 | - * |
|
12 | - * @return string |
|
13 | - */ |
|
14 | - protected static function getFacadeAccessor() |
|
15 | - { |
|
16 | - return \GeminiLabs\Castor\Helpers\PostMeta::class; |
|
17 | - } |
|
9 | + /** |
|
10 | + * Get the fully qualified class name of the component. |
|
11 | + * |
|
12 | + * @return string |
|
13 | + */ |
|
14 | + protected static function getFacadeAccessor() |
|
15 | + { |
|
16 | + return \GeminiLabs\Castor\Helpers\PostMeta::class; |
|
17 | + } |
|
18 | 18 | } |
@@ -6,13 +6,13 @@ |
||
6 | 6 | |
7 | 7 | class Media extends Facade |
8 | 8 | { |
9 | - /** |
|
10 | - * Get the fully qualified class name of the component. |
|
11 | - * |
|
12 | - * @return string |
|
13 | - */ |
|
14 | - protected static function getFacadeAccessor() |
|
15 | - { |
|
16 | - return \GeminiLabs\Castor\Helpers\Media::class; |
|
17 | - } |
|
9 | + /** |
|
10 | + * Get the fully qualified class name of the component. |
|
11 | + * |
|
12 | + * @return string |
|
13 | + */ |
|
14 | + protected static function getFacadeAccessor() |
|
15 | + { |
|
16 | + return \GeminiLabs\Castor\Helpers\Media::class; |
|
17 | + } |
|
18 | 18 | } |