@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | use Resta\Contracts\ApplicationHelpersContracts; |
| 16 | 16 | use Resta\Foundation\Bootstrapper\Bootstrappers; |
| 17 | 17 | |
| 18 | -class Application extends Kernel implements ApplicationContracts,ApplicationHelpersContracts |
|
| 18 | +class Application extends Kernel implements ApplicationContracts, ApplicationHelpersContracts |
|
| 19 | 19 | {
|
| 20 | 20 | //get app paths |
| 21 | 21 | use ApplicationPath; |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | * |
| 38 | 38 | * @param bool $console |
| 39 | 39 | */ |
| 40 | - public function __construct($console=false) |
|
| 40 | + public function __construct($console = false) |
|
| 41 | 41 | {
|
| 42 | 42 | // get console status for cli |
| 43 | 43 | $this->console = $console; |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | {
|
| 58 | 58 | // the booted objects are saved to the kernel. |
| 59 | 59 | // this method checks whether these objects are registered. |
| 60 | - return (isset($this['bindings'],$this['bindings'][$object])); |
|
| 60 | + return (isset($this['bindings'], $this['bindings'][$object])); |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | /** |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | // taking care of the differences between operating system |
| 77 | 77 | // and escaping arguments to prevent security issues. |
| 78 | 78 | // It replaces PHP functions like exec, passthru, shell_exec and system |
| 79 | - return $this->resolve(Command::class,['command'=>$command,'args'=>$arguments])->handle(); |
|
| 79 | + return $this->resolve(Command::class, ['command'=>$command, 'args'=>$arguments])->handle(); |
|
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | /** |
@@ -99,9 +99,9 @@ discard block |
||
| 99 | 99 | * @throws DependencyException |
| 100 | 100 | * @throws NotFoundException |
| 101 | 101 | */ |
| 102 | - public function config($config=null) |
|
| 102 | + public function config($config = null) |
|
| 103 | 103 | {
|
| 104 | - if($this->checkBindings(__FUNCTION__)){
|
|
| 104 | + if ($this->checkBindings(__FUNCTION__)) {
|
|
| 105 | 105 | return Config::make($config)->get(); |
| 106 | 106 | } |
| 107 | 107 | |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | */ |
| 144 | 144 | public function detectEnvironmentForApplicationKey() |
| 145 | 145 | {
|
| 146 | - if(isset($this['applicationKey'])){
|
|
| 146 | + if (isset($this['applicationKey'])) {
|
|
| 147 | 147 | |
| 148 | 148 | // application key, but if it has a null value |
| 149 | 149 | // then we move the environment value to the production environment. |
@@ -159,9 +159,9 @@ discard block |
||
| 159 | 159 | * @param array $environment |
| 160 | 160 | * @return mixed|string |
| 161 | 161 | */ |
| 162 | - public function environment($environment=array()) |
|
| 162 | + public function environment($environment = array()) |
|
| 163 | 163 | {
|
| 164 | - if($this->checkBindings(__FUNCTION__)){
|
|
| 164 | + if ($this->checkBindings(__FUNCTION__)) {
|
|
| 165 | 165 | |
| 166 | 166 | $arguments = (isset(func_get_args()[0])) |
| 167 | 167 | ? func_get_args()[0] : func_get_args(); |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | $environmentContainer = $this['environment']; |
| 175 | 175 | |
| 176 | 176 | return $environmentContainer->environment( |
| 177 | - $arguments,$this['environmentVariables'] |
|
| 177 | + $arguments, $this['environmentVariables'] |
|
| 178 | 178 | ); |
| 179 | 179 | } |
| 180 | 180 | |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | public function isLocale() |
| 207 | 207 | {
|
| 208 | 208 | //check environment for local |
| 209 | - return $this->environment() === 'local'; |
|
| 209 | + return $this->environment()==='local'; |
|
| 210 | 210 | } |
| 211 | 211 | |
| 212 | 212 | /** |
@@ -220,14 +220,14 @@ discard block |
||
| 220 | 220 | |
| 221 | 221 | // with the help of reflection instance, |
| 222 | 222 | // we get the kernel properties extended with the application object. |
| 223 | - foreach ($this['reflection']($this)->getProperties() as $property){
|
|
| 223 | + foreach ($this['reflection']($this)->getProperties() as $property) {
|
|
| 224 | 224 | $properties[] = $property->getName(); |
| 225 | 225 | } |
| 226 | 226 | |
| 227 | 227 | // we get the names of |
| 228 | 228 | // the kernel properties ended with groups through the Collection class. |
| 229 | - [$groups] = Collection::make($properties)->partition(function($properties){
|
|
| 230 | - return Str::endsWith($properties,'Groups'); |
|
| 229 | + [$groups] = Collection::make($properties)->partition(function($properties) {
|
|
| 230 | + return Str::endsWith($properties, 'Groups'); |
|
| 231 | 231 | }); |
| 232 | 232 | |
| 233 | 233 | //as a result, kernel groups are being returned. |
@@ -244,8 +244,8 @@ discard block |
||
| 244 | 244 | $list = []; |
| 245 | 245 | |
| 246 | 246 | //get kernel group names with manifest method |
| 247 | - foreach ($this->kernelGroupKeys() as $groupKey){
|
|
| 248 | - $list = array_merge($list,$this->manifest($groupKey)); |
|
| 247 | + foreach ($this->kernelGroupKeys() as $groupKey) {
|
|
| 248 | + $list = array_merge($list, $this->manifest($groupKey)); |
|
| 249 | 249 | } |
| 250 | 250 | |
| 251 | 251 | return $list; |
@@ -261,10 +261,10 @@ discard block |
||
| 261 | 261 | {
|
| 262 | 262 | // it adds the values in path data specified |
| 263 | 263 | // by callback to the configuration values. |
| 264 | - if($this['config'] instanceof ConfigProviderContracts){
|
|
| 264 | + if ($this['config'] instanceof ConfigProviderContracts) {
|
|
| 265 | 265 | |
| 266 | 266 | //set your path for config loader |
| 267 | - return tap($this['config'],function(ConfigProviderContracts $config) use($callback) {
|
|
| 267 | + return tap($this['config'], function(ConfigProviderContracts $config) use($callback) {
|
|
| 268 | 268 | return $config->setConfig(call_user_func($callback)); |
| 269 | 269 | }); |
| 270 | 270 | } |
@@ -279,19 +279,19 @@ discard block |
||
| 279 | 279 | * @param array $loaders |
| 280 | 280 | * @return mixed|void |
| 281 | 281 | */ |
| 282 | - public function loadIfNotExistBoot($loaders=array()) |
|
| 282 | + public function loadIfNotExistBoot($loaders = array()) |
|
| 283 | 283 | {
|
| 284 | 284 | //get kernel group list from application |
| 285 | 285 | $kernelGroupList = $this->kernelGroupList(); |
| 286 | 286 | |
| 287 | - foreach ($loaders as $loader){
|
|
| 287 | + foreach ($loaders as $loader) {
|
|
| 288 | 288 | |
| 289 | 289 | // if a service needs another boot service, |
| 290 | 290 | // the service is directly installed here and the service needs are resolved. |
| 291 | - if(isset($kernelGroupList[$loader]) && $this->checkBindings($loader)===false){
|
|
| 291 | + if (isset($kernelGroupList[$loader]) && $this->checkBindings($loader)===false) {
|
|
| 292 | 292 | |
| 293 | 293 | //with the boot loader kernel,we get the boot loader method. |
| 294 | - $this['closureBootLoader']->call(function() use($loader,$kernelGroupList) {
|
|
| 294 | + $this['closureBootLoader']->call(function() use($loader, $kernelGroupList) {
|
|
| 295 | 295 | $this->bootstrapper = $kernelGroupList[$loader]; |
| 296 | 296 | return $this->boot(); |
| 297 | 297 | }); |
@@ -308,7 +308,7 @@ discard block |
||
| 308 | 308 | public function manifest($maker) |
| 309 | 309 | {
|
| 310 | 310 | //kernel manifest bootstrapper |
| 311 | - return $this['bootstrapper']->bootFire(null,$maker); |
|
| 311 | + return $this['bootstrapper']->bootFire(null, $maker); |
|
| 312 | 312 | } |
| 313 | 313 | |
| 314 | 314 | /** |
@@ -319,7 +319,7 @@ discard block |
||
| 319 | 319 | public function runningInConsole() : bool |
| 320 | 320 | {
|
| 321 | 321 | //Determine if the application is running in the console. |
| 322 | - return php_sapi_name() === 'cli' || php_sapi_name() === 'phpdbg'; |
|
| 322 | + return php_sapi_name()==='cli' || php_sapi_name()==='phpdbg'; |
|
| 323 | 323 | } |
| 324 | 324 | |
| 325 | 325 | /** |
@@ -335,7 +335,7 @@ discard block |
||
| 335 | 335 | : []; |
| 336 | 336 | |
| 337 | 337 | //core kernel providers and project providers have been merged |
| 338 | - return array_merge($this->manifest('providers'),$providers);
|
|
| 338 | + return array_merge($this->manifest('providers'), $providers);
|
|
| 339 | 339 | } |
| 340 | 340 | |
| 341 | 341 | /** |
@@ -345,12 +345,12 @@ discard block |
||
| 345 | 345 | * @param null $path |
| 346 | 346 | * @return mixed|void |
| 347 | 347 | */ |
| 348 | - public function setPaths($name=null,$path=null) |
|
| 348 | + public function setPaths($name = null, $path = null) |
|
| 349 | 349 | {
|
| 350 | 350 | // save the globally identified paths to |
| 351 | 351 | // the global container object of the resta. |
| 352 | - if(!is_null($name) && !is_null($path) && file_exists($path)){
|
|
| 353 | - $this->register('paths',$name,$path);
|
|
| 352 | + if (!is_null($name) && !is_null($path) && file_exists($path)) {
|
|
| 353 | + $this->register('paths', $name, $path);
|
|
| 354 | 354 | } |
| 355 | 355 | } |
| 356 | 356 | |