@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | * @return boolean |
| 39 | 39 | */ |
| 40 | 40 | public static function debugging() { |
| 41 | - return ( defined( 'WP_DEBUG' ) && WP_DEBUG ); |
|
| 41 | + return (defined('WP_DEBUG') && WP_DEBUG); |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | /** |
@@ -57,8 +57,8 @@ discard block |
||
| 57 | 57 | * @return null |
| 58 | 58 | */ |
| 59 | 59 | public static function verifyBoot() { |
| 60 | - if ( ! static::isBooted() ) { |
|
| 61 | - throw new Exception( get_called_class() . ' must be booted first.' ); |
|
| 60 | + if ( ! static::isBooted()) { |
|
| 61 | + throw new Exception(get_called_class() . ' must be booted first.'); |
|
| 62 | 62 | } |
| 63 | 63 | } |
| 64 | 64 | |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | * @return Container |
| 69 | 69 | */ |
| 70 | 70 | public static function getContainer() { |
| 71 | - if ( static::$container === null ) { |
|
| 71 | + if (static::$container === null) { |
|
| 72 | 72 | static::$container = new Container(); |
| 73 | 73 | } |
| 74 | 74 | return static::$container; |
@@ -82,29 +82,29 @@ discard block |
||
| 82 | 82 | * @throws Exception |
| 83 | 83 | * @return null |
| 84 | 84 | */ |
| 85 | - public static function boot( $config = [] ) { |
|
| 86 | - if ( static::isBooted() ) { |
|
| 87 | - throw new Exception( get_called_class() . ' already booted.' ); |
|
| 85 | + public static function boot($config = []) { |
|
| 86 | + if (static::isBooted()) { |
|
| 87 | + throw new Exception(get_called_class() . ' already booted.'); |
|
| 88 | 88 | } |
| 89 | 89 | static::$booted = true; |
| 90 | 90 | |
| 91 | 91 | $container = static::getContainer(); |
| 92 | 92 | |
| 93 | - $container['framework.config'] = array_merge( [ |
|
| 93 | + $container['framework.config'] = array_merge([ |
|
| 94 | 94 | 'providers' => [], |
| 95 | - ], $config ); |
|
| 95 | + ], $config); |
|
| 96 | 96 | |
| 97 | - $container['framework.service_providers'] = array_merge( [ |
|
| 97 | + $container['framework.service_providers'] = array_merge([ |
|
| 98 | 98 | RoutingServiceProvider::class, |
| 99 | 99 | FlashServiceProvider::class, |
| 100 | 100 | OldInputServiceProvider::class, |
| 101 | 101 | TemplatingServiceProvider::class, |
| 102 | - ], $container['framework.config']['providers'] ); |
|
| 102 | + ], $container['framework.config']['providers']); |
|
| 103 | 103 | |
| 104 | - Facade::setFacadeApplication( $container ); |
|
| 104 | + Facade::setFacadeApplication($container); |
|
| 105 | 105 | AliasLoader::getInstance()->register(); |
| 106 | 106 | |
| 107 | - static::loadServiceProviders( $container ); |
|
| 107 | + static::loadServiceProviders($container); |
|
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | /** |
@@ -113,15 +113,15 @@ discard block |
||
| 113 | 113 | * @param Container $container |
| 114 | 114 | * @return null |
| 115 | 115 | */ |
| 116 | - protected static function loadServiceProviders( $container ) { |
|
| 117 | - $container['framework.service_providers'] = apply_filters( 'carbon_framework_service_providers', $container['framework.service_providers'] ); |
|
| 116 | + protected static function loadServiceProviders($container) { |
|
| 117 | + $container['framework.service_providers'] = apply_filters('carbon_framework_service_providers', $container['framework.service_providers']); |
|
| 118 | 118 | |
| 119 | - $service_providers = array_map( function( $service_provider ) { |
|
| 119 | + $service_providers = array_map(function($service_provider) { |
|
| 120 | 120 | return new $service_provider(); |
| 121 | - }, $container['framework.service_providers'] ); |
|
| 121 | + }, $container['framework.service_providers']); |
|
| 122 | 122 | |
| 123 | - static::registerServiceProviders( $service_providers, $container ); |
|
| 124 | - static::bootServiceProviders( $service_providers, $container ); |
|
| 123 | + static::registerServiceProviders($service_providers, $container); |
|
| 124 | + static::bootServiceProviders($service_providers, $container); |
|
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | /** |
@@ -130,9 +130,9 @@ discard block |
||
| 130 | 130 | * @param Container $container |
| 131 | 131 | * @return null |
| 132 | 132 | */ |
| 133 | - protected static function registerServiceProviders( $service_providers, $container ) { |
|
| 134 | - foreach ( $service_providers as $provider ) { |
|
| 135 | - $provider->register( $container ); |
|
| 133 | + protected static function registerServiceProviders($service_providers, $container) { |
|
| 134 | + foreach ($service_providers as $provider) { |
|
| 135 | + $provider->register($container); |
|
| 136 | 136 | } |
| 137 | 137 | } |
| 138 | 138 | |
@@ -142,9 +142,9 @@ discard block |
||
| 142 | 142 | * @param Container $container |
| 143 | 143 | * @return null |
| 144 | 144 | */ |
| 145 | - protected static function bootServiceProviders( $service_providers, $container ) { |
|
| 146 | - foreach ( $service_providers as $provider ) { |
|
| 147 | - $provider->boot( $container ); |
|
| 145 | + protected static function bootServiceProviders($service_providers, $container) { |
|
| 146 | + foreach ($service_providers as $provider) { |
|
| 147 | + $provider->boot($container); |
|
| 148 | 148 | } |
| 149 | 149 | } |
| 150 | 150 | |
@@ -155,8 +155,8 @@ discard block |
||
| 155 | 155 | * @param string $facade_class |
| 156 | 156 | * @return null |
| 157 | 157 | */ |
| 158 | - public static function facade( $alias, $facade_class ) { |
|
| 159 | - AliasLoader::getInstance()->alias( $alias, $facade_class ); |
|
| 158 | + public static function facade($alias, $facade_class) { |
|
| 159 | + AliasLoader::getInstance()->alias($alias, $facade_class); |
|
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | /** |
@@ -165,14 +165,14 @@ discard block |
||
| 165 | 165 | * @param string $key |
| 166 | 166 | * @return mixed|null |
| 167 | 167 | */ |
| 168 | - public static function resolve( $key ) { |
|
| 168 | + public static function resolve($key) { |
|
| 169 | 169 | static::verifyBoot(); |
| 170 | 170 | |
| 171 | - if ( ! isset( static::getContainer()[ $key ] ) ) { |
|
| 171 | + if ( ! isset(static::getContainer()[$key])) { |
|
| 172 | 172 | return null; |
| 173 | 173 | } |
| 174 | 174 | |
| 175 | - return static::getContainer()[ $key ]; |
|
| 175 | + return static::getContainer()[$key]; |
|
| 176 | 176 | } |
| 177 | 177 | |
| 178 | 178 | /** |
@@ -181,12 +181,12 @@ discard block |
||
| 181 | 181 | * @param string $class |
| 182 | 182 | * @return object |
| 183 | 183 | */ |
| 184 | - public static function instantiate( $class ) { |
|
| 184 | + public static function instantiate($class) { |
|
| 185 | 185 | static::verifyBoot(); |
| 186 | 186 | |
| 187 | - $instance = static::resolve( $class ); |
|
| 187 | + $instance = static::resolve($class); |
|
| 188 | 188 | |
| 189 | - if ( $instance === null ) { |
|
| 189 | + if ($instance === null) { |
|
| 190 | 190 | $instance = new $class(); |
| 191 | 191 | } |
| 192 | 192 | |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | * @param ResponseInterface $response |
| 200 | 200 | * @return null |
| 201 | 201 | */ |
| 202 | - public static function respond( ResponseInterface $response ) { |
|
| 203 | - Response::respond( $response ); |
|
| 202 | + public static function respond(ResponseInterface $response) { |
|
| 203 | + Response::respond($response); |
|
| 204 | 204 | } |
| 205 | 205 | } |