@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | * @param bool $static |
| 29 | 29 | * @return bool |
| 30 | 30 | */ |
| 31 | - protected function checkMacroConditions($static=false) |
|
| 31 | + protected function checkMacroConditions($static = false) |
|
| 32 | 32 | {
|
| 33 | 33 | return is_string($this->macro) && |
| 34 | 34 | Utils::isNamespaceExists($this->macro) && |
@@ -41,9 +41,9 @@ discard block |
||
| 41 | 41 | * @param bool $static |
| 42 | 42 | * @return bool |
| 43 | 43 | */ |
| 44 | - protected function checkMacroInstanceOf($static=false) |
|
| 44 | + protected function checkMacroInstanceOf($static = false) |
|
| 45 | 45 | {
|
| 46 | - if($static){
|
|
| 46 | + if ($static) {
|
|
| 47 | 47 | return true; |
| 48 | 48 | } |
| 49 | 49 | return $this->app->resolve($this->macro) instanceof MacroAbleContracts; |
@@ -56,15 +56,15 @@ discard block |
||
| 56 | 56 | * @param callable $callback |
| 57 | 57 | * @return mixed |
| 58 | 58 | */ |
| 59 | - public function get($method=null,callable $callback) |
|
| 59 | + public function get($method = null, callable $callback) |
|
| 60 | 60 | {
|
| 61 | - if($this->isMacro){
|
|
| 61 | + if ($this->isMacro) {
|
|
| 62 | 62 | |
| 63 | - if(is_null($method) && Utils::isNamespaceExists($this->macro)){
|
|
| 63 | + if (is_null($method) && Utils::isNamespaceExists($this->macro)) {
|
|
| 64 | 64 | return $this->app->resolve($this->macro); |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | - if(method_exists($resolve = $this->app->resolve($this->macro),$method)){
|
|
| 67 | + if (method_exists($resolve = $this->app->resolve($this->macro), $method)) {
|
|
| 68 | 68 | return $resolve->macro($this->class); |
| 69 | 69 | } |
| 70 | 70 | } |
@@ -78,11 +78,11 @@ discard block |
||
| 78 | 78 | * @param $class |
| 79 | 79 | * @return $this |
| 80 | 80 | */ |
| 81 | - public function isMacro($class,$static=false) |
|
| 81 | + public function isMacro($class, $static = false) |
|
| 82 | 82 | {
|
| 83 | 83 | // if the macro class is a valid object, |
| 84 | 84 | // then this macro will return a boolean value if it has the specified methode. |
| 85 | - if($this->checkMacroConditions($static)){
|
|
| 85 | + if ($this->checkMacroConditions($static)) {
|
|
| 86 | 86 | |
| 87 | 87 | $this->isMacro = true; |
| 88 | 88 | $this->class = $class; |
@@ -99,10 +99,10 @@ discard block |
||
| 99 | 99 | * @param $method |
| 100 | 100 | * @return mixed |
| 101 | 101 | */ |
| 102 | - public function with($macro,$concrete,$method=null) |
|
| 102 | + public function with($macro, $concrete, $method = null) |
|
| 103 | 103 | {
|
| 104 | - if($this->macro === null){
|
|
| 105 | - return $this($macro)->isMacro($concrete)->get($method,function() use($concrete){
|
|
| 104 | + if ($this->macro===null) {
|
|
| 105 | + return $this($macro)->isMacro($concrete)->get($method, function() use($concrete){
|
|
| 106 | 106 | return $concrete; |
| 107 | 107 | }); |
| 108 | 108 | } |
@@ -116,11 +116,11 @@ discard block |
||
| 116 | 116 | * @param $method |
| 117 | 117 | * @return mixed |
| 118 | 118 | */ |
| 119 | - public function withStatic($macro,$concrete) |
|
| 119 | + public function withStatic($macro, $concrete) |
|
| 120 | 120 | {
|
| 121 | - if($this->macro === null){
|
|
| 121 | + if ($this->macro===null) {
|
|
| 122 | 122 | |
| 123 | - return $this($macro)->isMacro($concrete,true)->get(null,is_callable($concrete) ? |
|
| 123 | + return $this($macro)->isMacro($concrete, true)->get(null, is_callable($concrete) ? |
|
| 124 | 124 | $concrete : function() use($concrete){
|
| 125 | 125 | return $concrete; |
| 126 | 126 | }); |
@@ -133,9 +133,9 @@ discard block |
||
| 133 | 133 | * @param null $macro |
| 134 | 134 | * @return $this |
| 135 | 135 | */ |
| 136 | - public function __invoke($macro=null) |
|
| 136 | + public function __invoke($macro = null) |
|
| 137 | 137 | {
|
| 138 | - if($macro!==null){
|
|
| 138 | + if ($macro!==null) {
|
|
| 139 | 139 | $this->macro = $macro; |
| 140 | 140 | } |
| 141 | 141 | return $this; |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | * |
| 40 | 40 | * @param bool $console |
| 41 | 41 | */ |
| 42 | - public function __construct($console=false) |
|
| 42 | + public function __construct($console = false) |
|
| 43 | 43 | {
|
| 44 | 44 | // get console status for cli |
| 45 | 45 | $this->console = $console; |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | {
|
| 60 | 60 | // the booted objects are saved to the kernel. |
| 61 | 61 | // this method checks whether these objects are registered. |
| 62 | - return (isset($this['bindings'],$this['bindings'][$object])); |
|
| 62 | + return (isset($this['bindings'], $this['bindings'][$object])); |
|
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | /** |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | // taking care of the differences between operating system |
| 79 | 79 | // and escaping arguments to prevent security issues. |
| 80 | 80 | // It replaces PHP functions like exec, passthru, shell_exec and system |
| 81 | - return $this->resolve(Command::class,['command'=>$command,'args'=>$arguments])->handle(); |
|
| 81 | + return $this->resolve(Command::class, ['command'=>$command, 'args'=>$arguments])->handle(); |
|
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | /** |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | */ |
| 104 | 104 | public function config($config) |
| 105 | 105 | {
|
| 106 | - if($this->checkBindings(__FUNCTION__)){
|
|
| 106 | + if ($this->checkBindings(__FUNCTION__)) {
|
|
| 107 | 107 | |
| 108 | 108 | /** @var Macro $macro */ |
| 109 | 109 | $macro = $this['macro']; |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | // this includes the configuration macro class. |
| 112 | 112 | // therefore, you can expand your configuration settings from |
| 113 | 113 | // the application kernel identifier to the desired class. |
| 114 | - return $macro->withStatic(Config::macro(),function() use($config){
|
|
| 114 | + return $macro->withStatic(Config::macro(), function() use($config){
|
|
| 115 | 115 | return Config::make($config); |
| 116 | 116 | })->get(); |
| 117 | 117 | |
@@ -154,9 +154,9 @@ discard block |
||
| 154 | 154 | * @param array $environment |
| 155 | 155 | * @return mixed|string |
| 156 | 156 | */ |
| 157 | - public function environment($environment=array()) |
|
| 157 | + public function environment($environment = array()) |
|
| 158 | 158 | {
|
| 159 | - if($this->checkBindings(__FUNCTION__)){
|
|
| 159 | + if ($this->checkBindings(__FUNCTION__)) {
|
|
| 160 | 160 | |
| 161 | 161 | $arguments = (isset(func_get_args()[0])) |
| 162 | 162 | ? func_get_args()[0] : func_get_args(); |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | $environmentContainer = $this['environment']; |
| 166 | 166 | |
| 167 | 167 | return $environmentContainer->environment( |
| 168 | - $arguments,$this['environmentVariables'] |
|
| 168 | + $arguments, $this['environmentVariables'] |
|
| 169 | 169 | ); |
| 170 | 170 | } |
| 171 | 171 | |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | public function isLocale() : bool |
| 198 | 198 | {
|
| 199 | 199 | //check environment for local |
| 200 | - return $this->environment() === 'local'; |
|
| 200 | + return $this->environment()==='local'; |
|
| 201 | 201 | } |
| 202 | 202 | |
| 203 | 203 | /** |
@@ -211,14 +211,14 @@ discard block |
||
| 211 | 211 | |
| 212 | 212 | // with the help of reflection instance, |
| 213 | 213 | // we get the kernel properties extended with the application object. |
| 214 | - foreach ($this['reflection']($this)->getProperties() as $property){
|
|
| 214 | + foreach ($this['reflection']($this)->getProperties() as $property) {
|
|
| 215 | 215 | $properties[] = $property->getName(); |
| 216 | 216 | } |
| 217 | 217 | |
| 218 | 218 | // we get the names of |
| 219 | 219 | // the kernel properties ended with groups through the Collection class. |
| 220 | - [$groups] = Collection::make($properties)->partition(function($properties){
|
|
| 221 | - return Str::endsWith($properties,'Groups'); |
|
| 220 | + [$groups] = Collection::make($properties)->partition(function($properties) {
|
|
| 221 | + return Str::endsWith($properties, 'Groups'); |
|
| 222 | 222 | }); |
| 223 | 223 | |
| 224 | 224 | //as a result, kernel groups are being returned. |
@@ -235,8 +235,8 @@ discard block |
||
| 235 | 235 | $list = []; |
| 236 | 236 | |
| 237 | 237 | //get kernel group names with manifest method |
| 238 | - foreach ($this->kernelGroupKeys() as $groupKey){
|
|
| 239 | - $list = array_merge($list,$this->manifest($groupKey)); |
|
| 238 | + foreach ($this->kernelGroupKeys() as $groupKey) {
|
|
| 239 | + $list = array_merge($list, $this->manifest($groupKey)); |
|
| 240 | 240 | } |
| 241 | 241 | |
| 242 | 242 | return $list; |
@@ -252,14 +252,14 @@ discard block |
||
| 252 | 252 | {
|
| 253 | 253 | // it adds the values in path data specified |
| 254 | 254 | // by callback to the configuration values. |
| 255 | - if($this['config'] instanceof ConfigProviderContracts){
|
|
| 255 | + if ($this['config'] instanceof ConfigProviderContracts) {
|
|
| 256 | 256 | |
| 257 | 257 | //set your path for config loader |
| 258 | - tap($this['config'],function(ConfigProviderContracts $config) use($callback) {
|
|
| 258 | + tap($this['config'], function(ConfigProviderContracts $config) use($callback) {
|
|
| 259 | 259 | $config->setConfig(call_user_func($callback)); |
| 260 | 260 | }); |
| 261 | 261 | } |
| 262 | - else{
|
|
| 262 | + else {
|
|
| 263 | 263 | //set config instance exception for application |
| 264 | 264 | exception()->unexpectedValue('config instance is not loaded for application container');
|
| 265 | 265 | } |
@@ -271,7 +271,7 @@ discard block |
||
| 271 | 271 | * @param array $loaders |
| 272 | 272 | * @return mixed|void |
| 273 | 273 | */ |
| 274 | - public function loadIfNotExistBoot($loaders=array()) |
|
| 274 | + public function loadIfNotExistBoot($loaders = array()) |
|
| 275 | 275 | {
|
| 276 | 276 | //get kernel group list from application |
| 277 | 277 | $kernelGroupList = $this->kernelGroupList(); |
@@ -279,14 +279,14 @@ discard block |
||
| 279 | 279 | /** @var ClosureDispatcherContracts $closureBootLoader */ |
| 280 | 280 | $closureBootLoader = $this['closureBootLoader']; |
| 281 | 281 | |
| 282 | - foreach ($loaders as $loader){
|
|
| 282 | + foreach ($loaders as $loader) {
|
|
| 283 | 283 | |
| 284 | 284 | // if a service needs another boot service, |
| 285 | 285 | // the service is directly installed here and the service needs are resolved. |
| 286 | - if(isset($kernelGroupList[$loader]) && $this->checkBindings($loader)===false){
|
|
| 286 | + if (isset($kernelGroupList[$loader]) && $this->checkBindings($loader)===false) {
|
|
| 287 | 287 | |
| 288 | 288 | //with the boot loader kernel,we get the boot loader method. |
| 289 | - $closureBootLoader->call(function() use($loader,$kernelGroupList) {
|
|
| 289 | + $closureBootLoader->call(function() use($loader, $kernelGroupList) {
|
|
| 290 | 290 | |
| 291 | 291 | /** @var BootLoader $bootLoader */ |
| 292 | 292 | $bootLoader = $this; |
@@ -309,7 +309,7 @@ discard block |
||
| 309 | 309 | $bootstrapper = $this['bootstrapper']; |
| 310 | 310 | |
| 311 | 311 | //kernel manifest bootstrapper |
| 312 | - return $bootstrapper->bootFire(null,$maker); |
|
| 312 | + return $bootstrapper->bootFire(null, $maker); |
|
| 313 | 313 | } |
| 314 | 314 | |
| 315 | 315 | /** |
@@ -320,7 +320,7 @@ discard block |
||
| 320 | 320 | public function runningInConsole() : bool |
| 321 | 321 | {
|
| 322 | 322 | //Determine if the application is running in the console. |
| 323 | - return php_sapi_name() === 'cli' || php_sapi_name() === 'phpdbg'; |
|
| 323 | + return php_sapi_name()==='cli' || php_sapi_name()==='phpdbg'; |
|
| 324 | 324 | } |
| 325 | 325 | |
| 326 | 326 | /** |
@@ -336,7 +336,7 @@ discard block |
||
| 336 | 336 | : []; |
| 337 | 337 | |
| 338 | 338 | //core kernel providers and project providers have been merged |
| 339 | - return array_merge($this->manifest('providers'),$providers);
|
|
| 339 | + return array_merge($this->manifest('providers'), $providers);
|
|
| 340 | 340 | } |
| 341 | 341 | |
| 342 | 342 | /** |
@@ -346,12 +346,12 @@ discard block |
||
| 346 | 346 | * @param string $path |
| 347 | 347 | * @return mixed|void |
| 348 | 348 | */ |
| 349 | - public function setPaths($name,$path) |
|
| 349 | + public function setPaths($name, $path) |
|
| 350 | 350 | {
|
| 351 | 351 | // save the globally identified paths to |
| 352 | 352 | // the global container object of the resta. |
| 353 | - if(file_exists($path)){
|
|
| 354 | - $this->register('paths',$name,$path);
|
|
| 353 | + if (file_exists($path)) {
|
|
| 354 | + $this->register('paths', $name, $path);
|
|
| 355 | 355 | } |
| 356 | 356 | } |
| 357 | 357 | |