@@ -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 | |
@@ -142,9 +142,9 @@ discard block |
||
| 142 | 142 | * @param array $environment |
| 143 | 143 | * @return mixed|string |
| 144 | 144 | */ |
| 145 | - public function environment($environment=array()) |
|
| 145 | + public function environment($environment = array()) |
|
| 146 | 146 | {
|
| 147 | - if($this->checkBindings(__FUNCTION__)){
|
|
| 147 | + if ($this->checkBindings(__FUNCTION__)) {
|
|
| 148 | 148 | |
| 149 | 149 | $arguments = (isset(func_get_args()[0])) |
| 150 | 150 | ? func_get_args()[0] : func_get_args(); |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | $environmentContainer = $this['environment']; |
| 154 | 154 | |
| 155 | 155 | return $environmentContainer->environment( |
| 156 | - $arguments,$this['environmentVariables'] |
|
| 156 | + $arguments, $this['environmentVariables'] |
|
| 157 | 157 | ); |
| 158 | 158 | } |
| 159 | 159 | |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | public function isLocale() : bool |
| 186 | 186 | {
|
| 187 | 187 | //check environment for local |
| 188 | - return $this->environment() === 'local'; |
|
| 188 | + return $this->environment()==='local'; |
|
| 189 | 189 | } |
| 190 | 190 | |
| 191 | 191 | /** |
@@ -199,14 +199,14 @@ discard block |
||
| 199 | 199 | |
| 200 | 200 | // with the help of reflection instance, |
| 201 | 201 | // we get the kernel properties extended with the application object. |
| 202 | - foreach ($this['reflection']($this)->getProperties() as $property){
|
|
| 202 | + foreach ($this['reflection']($this)->getProperties() as $property) {
|
|
| 203 | 203 | $properties[] = $property->getName(); |
| 204 | 204 | } |
| 205 | 205 | |
| 206 | 206 | // we get the names of |
| 207 | 207 | // the kernel properties ended with groups through the Collection class. |
| 208 | - [$groups] = Collection::make($properties)->partition(function($properties){
|
|
| 209 | - return Str::endsWith($properties,'Groups'); |
|
| 208 | + [$groups] = Collection::make($properties)->partition(function($properties) {
|
|
| 209 | + return Str::endsWith($properties, 'Groups'); |
|
| 210 | 210 | }); |
| 211 | 211 | |
| 212 | 212 | //as a result, kernel groups are being returned. |
@@ -223,8 +223,8 @@ discard block |
||
| 223 | 223 | $list = []; |
| 224 | 224 | |
| 225 | 225 | //get kernel group names with manifest method |
| 226 | - foreach ($this->kernelGroupKeys() as $groupKey){
|
|
| 227 | - $list = array_merge($list,$this->manifest($groupKey)); |
|
| 226 | + foreach ($this->kernelGroupKeys() as $groupKey) {
|
|
| 227 | + $list = array_merge($list, $this->manifest($groupKey)); |
|
| 228 | 228 | } |
| 229 | 229 | |
| 230 | 230 | return $list; |
@@ -240,10 +240,10 @@ discard block |
||
| 240 | 240 | {
|
| 241 | 241 | // it adds the values in path data specified |
| 242 | 242 | // by callback to the configuration values. |
| 243 | - if($this['config'] instanceof ConfigProviderContracts){
|
|
| 243 | + if ($this['config'] instanceof ConfigProviderContracts) {
|
|
| 244 | 244 | |
| 245 | 245 | //set your path for config loader |
| 246 | - return tap($this['config'],function(ConfigProviderContracts $config) use($callback) {
|
|
| 246 | + return tap($this['config'], function(ConfigProviderContracts $config) use($callback) {
|
|
| 247 | 247 | return $config->setConfig(call_user_func($callback)); |
| 248 | 248 | }); |
| 249 | 249 | } |
@@ -258,19 +258,19 @@ discard block |
||
| 258 | 258 | * @param array $loaders |
| 259 | 259 | * @return mixed|void |
| 260 | 260 | */ |
| 261 | - public function loadIfNotExistBoot($loaders=array()) |
|
| 261 | + public function loadIfNotExistBoot($loaders = array()) |
|
| 262 | 262 | {
|
| 263 | 263 | //get kernel group list from application |
| 264 | 264 | $kernelGroupList = $this->kernelGroupList(); |
| 265 | 265 | |
| 266 | - foreach ($loaders as $loader){
|
|
| 266 | + foreach ($loaders as $loader) {
|
|
| 267 | 267 | |
| 268 | 268 | // if a service needs another boot service, |
| 269 | 269 | // the service is directly installed here and the service needs are resolved. |
| 270 | - if(isset($kernelGroupList[$loader]) && $this->checkBindings($loader)===false){
|
|
| 270 | + if (isset($kernelGroupList[$loader]) && $this->checkBindings($loader)===false) {
|
|
| 271 | 271 | |
| 272 | 272 | //with the boot loader kernel,we get the boot loader method. |
| 273 | - $this['closureBootLoader']->call(function() use($loader,$kernelGroupList) {
|
|
| 273 | + $this['closureBootLoader']->call(function() use($loader, $kernelGroupList) {
|
|
| 274 | 274 | $this->bootstrapper = $kernelGroupList[$loader]; |
| 275 | 275 | return $this->boot(); |
| 276 | 276 | }); |
@@ -287,7 +287,7 @@ discard block |
||
| 287 | 287 | public function manifest($maker) |
| 288 | 288 | {
|
| 289 | 289 | //kernel manifest bootstrapper |
| 290 | - return $this['bootstrapper']->bootFire(null,$maker); |
|
| 290 | + return $this['bootstrapper']->bootFire(null, $maker); |
|
| 291 | 291 | } |
| 292 | 292 | |
| 293 | 293 | /** |
@@ -298,7 +298,7 @@ discard block |
||
| 298 | 298 | public function runningInConsole() : bool |
| 299 | 299 | {
|
| 300 | 300 | //Determine if the application is running in the console. |
| 301 | - return php_sapi_name() === 'cli' || php_sapi_name() === 'phpdbg'; |
|
| 301 | + return php_sapi_name()==='cli' || php_sapi_name()==='phpdbg'; |
|
| 302 | 302 | } |
| 303 | 303 | |
| 304 | 304 | /** |
@@ -314,7 +314,7 @@ discard block |
||
| 314 | 314 | : []; |
| 315 | 315 | |
| 316 | 316 | //core kernel providers and project providers have been merged |
| 317 | - return array_merge($this->manifest('providers'),$providers);
|
|
| 317 | + return array_merge($this->manifest('providers'), $providers);
|
|
| 318 | 318 | } |
| 319 | 319 | |
| 320 | 320 | /** |
@@ -324,12 +324,12 @@ discard block |
||
| 324 | 324 | * @param string $path |
| 325 | 325 | * @return mixed|void |
| 326 | 326 | */ |
| 327 | - public function setPaths($name,$path) |
|
| 327 | + public function setPaths($name, $path) |
|
| 328 | 328 | {
|
| 329 | 329 | // save the globally identified paths to |
| 330 | 330 | // the global container object of the resta. |
| 331 | - if(file_exists($path)){
|
|
| 332 | - $this->register('paths',$name,$path);
|
|
| 331 | + if (file_exists($path)) {
|
|
| 332 | + $this->register('paths', $name, $path);
|
|
| 333 | 333 | } |
| 334 | 334 | } |
| 335 | 335 | |