@@ -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 | } |
@@ -30,15 +30,15 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | |
@@ -18,11 +18,11 @@ |
||
| 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 | 28 | /** |
@@ -32,7 +32,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | |
@@ -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 | } |
@@ -8,7 +8,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | } |
@@ -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 | } |
@@ -8,7 +8,7 @@ discard block |
||
| 8 | 8 | { |
| 9 | 9 | public $postmeta; |
| 10 | 10 | |
| 11 | - public function __construct( PostMeta $postmeta ) |
|
| 11 | + public function __construct(PostMeta $postmeta) |
|
| 12 | 12 | { |
| 13 | 13 | $this->postmeta = $postmeta; |
| 14 | 14 | } |
@@ -18,9 +18,9 @@ discard block |
||
| 18 | 18 | * |
| 19 | 19 | * @return string |
| 20 | 20 | */ |
| 21 | - public function assetPath( $asset ) |
|
| 21 | + public function assetPath($asset) |
|
| 22 | 22 | { |
| 23 | - return $this->paths( 'dir.stylesheet' ) . 'assets/' . $asset; |
|
| 23 | + return $this->paths('dir.stylesheet') . 'assets/' . $asset; |
|
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | /** |
@@ -28,9 +28,9 @@ discard block |
||
| 28 | 28 | * |
| 29 | 29 | * @return string |
| 30 | 30 | */ |
| 31 | - public function assetUri( $asset ) |
|
| 31 | + public function assetUri($asset) |
|
| 32 | 32 | { |
| 33 | - return $this->paths( 'uri.stylesheet' ) . 'assets/' . $asset; |
|
| 33 | + return $this->paths('uri.stylesheet') . 'assets/' . $asset; |
|
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | /** |
@@ -44,9 +44,9 @@ discard block |
||
| 44 | 44 | is_single(), |
| 45 | 45 | ]; |
| 46 | 46 | |
| 47 | - $display = in_array( true, $conditions ); |
|
| 47 | + $display = in_array(true, $conditions); |
|
| 48 | 48 | |
| 49 | - return apply_filters( 'castor/display/sidebar', $display ); |
|
| 49 | + return apply_filters('castor/display/sidebar', $display); |
|
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | /** |
@@ -54,9 +54,9 @@ discard block |
||
| 54 | 54 | * |
| 55 | 55 | * @return string |
| 56 | 56 | */ |
| 57 | - public function imagePath( $asset ) |
|
| 57 | + public function imagePath($asset) |
|
| 58 | 58 | { |
| 59 | - return $this->paths( 'dir.stylesheet' ) . 'assets/img/' . $asset; |
|
| 59 | + return $this->paths('dir.stylesheet') . 'assets/img/' . $asset; |
|
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | /** |
@@ -64,16 +64,16 @@ discard block |
||
| 64 | 64 | * |
| 65 | 65 | * @return string |
| 66 | 66 | */ |
| 67 | - public function imageUri( $asset ) |
|
| 67 | + public function imageUri($asset) |
|
| 68 | 68 | { |
| 69 | - return $this->paths( 'uri.stylesheet' ) . 'assets/img/' . $asset; |
|
| 69 | + return $this->paths('uri.stylesheet') . 'assets/img/' . $asset; |
|
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | public function pageTitle() |
| 73 | 73 | { |
| 74 | - foreach( ['is_404', 'is_archive', 'is_home', 'is_page', 'is_search'] as $bool ) { |
|
| 75 | - if( !$bool() )continue; |
|
| 76 | - $method = sprintf( 'get%sTitle', ucfirst( str_replace( 'is_', '', $bool ))); |
|
| 74 | + foreach (['is_404', 'is_archive', 'is_home', 'is_page', 'is_search'] as $bool) { |
|
| 75 | + if (!$bool())continue; |
|
| 76 | + $method = sprintf('get%sTitle', ucfirst(str_replace('is_', '', $bool))); |
|
| 77 | 77 | return $this->$method(); |
| 78 | 78 | } |
| 79 | 79 | |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | * |
| 86 | 86 | * @return array|string |
| 87 | 87 | */ |
| 88 | - public function paths( $path = null ) |
|
| 88 | + public function paths($path = null) |
|
| 89 | 89 | { |
| 90 | 90 | $paths = [ |
| 91 | 91 | 'dir.stylesheet' => get_stylesheet_directory(), |
@@ -95,12 +95,12 @@ discard block |
||
| 95 | 95 | 'uri.template' => get_template_directory_uri(), |
| 96 | 96 | ]; |
| 97 | 97 | |
| 98 | - if( is_null( $path )) { |
|
| 98 | + if (is_null($path)) { |
|
| 99 | 99 | return $paths; |
| 100 | 100 | } |
| 101 | 101 | |
| 102 | - return array_key_exists( $path, $paths ) |
|
| 103 | - ? trailingslashit( $paths[$path] ) |
|
| 102 | + return array_key_exists($path, $paths) |
|
| 103 | + ? trailingslashit($paths[$path]) |
|
| 104 | 104 | : ''; |
| 105 | 105 | } |
| 106 | 106 | |
@@ -109,16 +109,16 @@ discard block |
||
| 109 | 109 | * |
| 110 | 110 | * @return string|null |
| 111 | 111 | */ |
| 112 | - public function svg( $path = null ) |
|
| 112 | + public function svg($path = null) |
|
| 113 | 113 | { |
| 114 | - if( $svg = file_get_contents( $this->imageUri( $path ))) { |
|
| 114 | + if ($svg = file_get_contents($this->imageUri($path))) { |
|
| 115 | 115 | return $svg; |
| 116 | 116 | } |
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | protected function get404Title() |
| 120 | 120 | { |
| 121 | - return __( 'Not Found', 'castor' ); |
|
| 121 | + return __('Not Found', 'castor'); |
|
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | protected function getArchiveTitle() |
@@ -128,20 +128,20 @@ discard block |
||
| 128 | 128 | |
| 129 | 129 | protected function getHomeTitle() |
| 130 | 130 | { |
| 131 | - return ( $home = get_option( 'page_for_posts', true )) |
|
| 132 | - ? get_the_title( $home ) |
|
| 133 | - : __( 'Latest Posts', 'castor' ); |
|
| 131 | + return ($home = get_option('page_for_posts', true)) |
|
| 132 | + ? get_the_title($home) |
|
| 133 | + : __('Latest Posts', 'castor'); |
|
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | protected function getPageTitle() |
| 137 | 137 | { |
| 138 | - return ($title = $this->postmeta->get( 'title' )) |
|
| 138 | + return ($title = $this->postmeta->get('title')) |
|
| 139 | 139 | ? $title |
| 140 | 140 | : get_the_title(); |
| 141 | 141 | } |
| 142 | 142 | |
| 143 | 143 | protected function getSearchTitle() |
| 144 | 144 | { |
| 145 | - return sprintf( __( 'Search Results for %s', 'castor' ), get_search_query() ); |
|
| 145 | + return sprintf(__('Search Results for %s', 'castor'), get_search_query()); |
|
| 146 | 146 | } |
| 147 | 147 | } |