@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | */ |
49 | 49 | function applicationKey() |
50 | 50 | { |
51 | - if(property_exists($kernel=app()->kernel(),'applicationKey')){ |
|
51 | + if (property_exists($kernel = app()->kernel(), 'applicationKey')) { |
|
52 | 52 | return $kernel->applicationKey; |
53 | 53 | } |
54 | 54 | return null; |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | */ |
82 | 82 | function bundleName() |
83 | 83 | { |
84 | - if(defined('endpoint')){ |
|
84 | + if (defined('endpoint')) { |
|
85 | 85 | |
86 | 86 | return endpoint.''.StaticPathList::$controllerBundleName; |
87 | 87 | } |
@@ -96,11 +96,11 @@ discard block |
||
96 | 96 | * @param null $default |
97 | 97 | * @return mixed|null |
98 | 98 | */ |
99 | - function config($config=null,$default=null) |
|
99 | + function config($config = null, $default = null) |
|
100 | 100 | { |
101 | 101 | $configResult = app()->config($config); |
102 | 102 | |
103 | - if($configResult === null && $default!==null){ |
|
103 | + if ($configResult===null && $default!==null) { |
|
104 | 104 | return $default; |
105 | 105 | } |
106 | 106 | |
@@ -115,9 +115,9 @@ discard block |
||
115 | 115 | * @param $bind array |
116 | 116 | * @return mixed |
117 | 117 | */ |
118 | - function container($class,$bind=array()) |
|
118 | + function container($class, $bind = array()) |
|
119 | 119 | { |
120 | - return app()->singleton()->appClass->container(appInstance(),$class,$bind); |
|
120 | + return app()->singleton()->appClass->container(appInstance(), $class, $bind); |
|
121 | 121 | } |
122 | 122 | } |
123 | 123 | |
@@ -177,10 +177,10 @@ discard block |
||
177 | 177 | * @param array $params |
178 | 178 | * @return ExceptionContracts |
179 | 179 | */ |
180 | - function exception($name=null,$params=array()) |
|
180 | + function exception($name = null, $params = array()) |
|
181 | 181 | { |
182 | - $exceptionManager=ExceptionManager::class; |
|
183 | - return app()->resolve($exceptionManager,['name'=>$name,'params'=>$params]); |
|
182 | + $exceptionManager = ExceptionManager::class; |
|
183 | + return app()->resolve($exceptionManager, ['name'=>$name, 'params'=>$params]); |
|
184 | 184 | } |
185 | 185 | } |
186 | 186 | |
@@ -190,13 +190,13 @@ discard block |
||
190 | 190 | * @param null $locale |
191 | 191 | * @return Generator |
192 | 192 | */ |
193 | - function faker($locale=null) |
|
193 | + function faker($locale = null) |
|
194 | 194 | { |
195 | - if($locale===null){ |
|
196 | - $faker=Factory::create(); |
|
195 | + if ($locale===null) { |
|
196 | + $faker = Factory::create(); |
|
197 | 197 | } |
198 | - else{ |
|
199 | - $faker=Factory::create($locale); |
|
198 | + else { |
|
199 | + $faker = Factory::create($locale); |
|
200 | 200 | } |
201 | 201 | |
202 | 202 | return $faker; |
@@ -207,8 +207,8 @@ discard block |
||
207 | 207 | |
208 | 208 | function fingerPrint() |
209 | 209 | { |
210 | - return md5(sha1(implode("|",[ |
|
211 | - request()->getClientIp(),applicationKey() |
|
210 | + return md5(sha1(implode("|", [ |
|
211 | + request()->getClientIp(), applicationKey() |
|
212 | 212 | ]))); |
213 | 213 | } |
214 | 214 | } |
@@ -228,10 +228,10 @@ discard block |
||
228 | 228 | * @param null $default |
229 | 229 | * @return null |
230 | 230 | */ |
231 | - function get($param=null,$default=null) |
|
231 | + function get($param = null, $default = null) |
|
232 | 232 | { |
233 | 233 | //symfony request query object |
234 | - $get=core()->get; |
|
234 | + $get = core()->get; |
|
235 | 235 | |
236 | 236 | return ($param===null) ? $get : (isset($get[$param]) ? $get[$param] : $default); |
237 | 237 | } |
@@ -244,14 +244,14 @@ discard block |
||
244 | 244 | * @param null $default |
245 | 245 | * @return array|string |
246 | 246 | */ |
247 | - function headers($param=null,$default=null) |
|
247 | + function headers($param = null, $default = null) |
|
248 | 248 | { |
249 | - $list=[]; |
|
249 | + $list = []; |
|
250 | 250 | |
251 | 251 | //We only get the objects in the list name to match the header objects |
252 | 252 | //that come with the request path to the objects sent by the client |
253 | 253 | foreach (request()->headers->all() as $key=>$value) { |
254 | - $list[$key]=$value; |
|
254 | + $list[$key] = $value; |
|
255 | 255 | } |
256 | 256 | |
257 | 257 | //return header list |
@@ -276,9 +276,9 @@ discard block |
||
276 | 276 | * @param $file null |
277 | 277 | * @return LoggerHandler |
278 | 278 | */ |
279 | - function logger($file=null) |
|
279 | + function logger($file = null) |
|
280 | 280 | { |
281 | - return app()->resolve(LoggerHandler::class,['file'=>$file]); |
|
281 | + return app()->resolve(LoggerHandler::class, ['file'=>$file]); |
|
282 | 282 | } |
283 | 283 | } |
284 | 284 | |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | */ |
301 | 301 | function response() |
302 | 302 | { |
303 | - $object=debug_backtrace()[1]['object']; |
|
303 | + $object = debug_backtrace()[1]['object']; |
|
304 | 304 | return new ResponseOutManager($object); |
305 | 305 | } |
306 | 306 | } |
@@ -315,9 +315,9 @@ discard block |
||
315 | 315 | * @throws \DI\DependencyException |
316 | 316 | * @throws \DI\NotFoundException |
317 | 317 | */ |
318 | - function resolve($class,$bind=array()) |
|
318 | + function resolve($class, $bind = array()) |
|
319 | 319 | { |
320 | - return app()->resolve($class,$bind); |
|
320 | + return app()->resolve($class, $bind); |
|
321 | 321 | } |
322 | 322 | } |
323 | 323 | |
@@ -328,7 +328,7 @@ discard block |
||
328 | 328 | */ |
329 | 329 | function policy() |
330 | 330 | { |
331 | - $policyPath = implode('/',[ |
|
331 | + $policyPath = implode('/', [ |
|
332 | 332 | Route::getRouteControllerNamespace(), |
333 | 333 | 'Policy', |
334 | 334 | Route::getRouteControllerClass().'Policy' |
@@ -336,7 +336,7 @@ discard block |
||
336 | 336 | |
337 | 337 | $policyNamespace = Utils::getNamespace($policyPath); |
338 | 338 | |
339 | - if(Utils::isNamespaceExists($policyNamespace)){ |
|
339 | + if (Utils::isNamespaceExists($policyNamespace)) { |
|
340 | 340 | return app()->resolve(Utils::getNamespace($policyPath)); |
341 | 341 | } |
342 | 342 | |
@@ -351,10 +351,10 @@ discard block |
||
351 | 351 | * @param $key |
352 | 352 | * @return mixed |
353 | 353 | */ |
354 | - function route($key=null) |
|
354 | + function route($key = null) |
|
355 | 355 | { |
356 | - if(is_null($key)){ |
|
357 | - return array_map(function($route){ |
|
356 | + if (is_null($key)) { |
|
357 | + return array_map(function($route) { |
|
358 | 358 | return strtolower($route); |
359 | 359 | },app()->singleton()->appClass->route($key)); |
360 | 360 | } |
@@ -382,10 +382,10 @@ discard block |
||
382 | 382 | * @param null $default |
383 | 383 | * @return mixed |
384 | 384 | */ |
385 | - function post($param=null,$default=null) |
|
385 | + function post($param = null, $default = null) |
|
386 | 386 | { |
387 | 387 | //symfony request query object |
388 | - $post=core()->post; |
|
388 | + $post = core()->post; |
|
389 | 389 | |
390 | 390 | return ($param===null) ? $post : (isset($post[$param]) ? $post[$param] : $default); |
391 | 391 | } |
@@ -416,9 +416,9 @@ discard block |
||
416 | 416 | * @param array $select |
417 | 417 | * @return mixed |
418 | 418 | */ |
419 | - function trans($lang,$select=array()) |
|
419 | + function trans($lang, $select = array()) |
|
420 | 420 | { |
421 | - return app()->singleton()->appClass->translator($lang,$select); |
|
421 | + return app()->singleton()->appClass->translator($lang, $select); |
|
422 | 422 | } |
423 | 423 | } |
424 | 424 | |
@@ -431,7 +431,7 @@ discard block |
||
431 | 431 | { |
432 | 432 | $file = app()->path()->kernel().''.DIRECTORY_SEPARATOR.'service.json'; |
433 | 433 | |
434 | - if(file_exists($file)){ |
|
434 | + if (file_exists($file)) { |
|
435 | 435 | return $file; |
436 | 436 | } |
437 | 437 |
@@ -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 = (is_bool($console)) ? $console : true; |
@@ -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 | /** |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | // taking care of the differences between operating system |
76 | 76 | // and escaping arguments to prevent security issues. |
77 | 77 | // It replaces PHP functions like exec, passthru, shell_exec and system |
78 | - return $this->resolve(Command::class,['command'=>$command,'args'=>$arguments])->handle(); |
|
78 | + return $this->resolve(Command::class, ['command'=>$command, 'args'=>$arguments])->handle(); |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | /** |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | */ |
101 | 101 | public function config($config) |
102 | 102 | { |
103 | - if($this->checkBindings(__FUNCTION__)){ |
|
103 | + if ($this->checkBindings(__FUNCTION__)) { |
|
104 | 104 | |
105 | 105 | /** @var Macro $macro */ |
106 | 106 | $macro = $this['macro']; |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | // this includes the configuration macro class. |
109 | 109 | // therefore, you can expand your configuration settings from |
110 | 110 | // the application kernel identifier to the desired class. |
111 | - return $macro->withStatic(Config::macro(),function() use($config){ |
|
111 | + return $macro->withStatic(Config::macro(), function() use($config){ |
|
112 | 112 | return Config::make($config); |
113 | 113 | })->get(); |
114 | 114 | |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | */ |
141 | 141 | public function containerCacheFile() |
142 | 142 | { |
143 | - if(!is_null(serviceJson())){ |
|
143 | + if (!is_null(serviceJson())) { |
|
144 | 144 | return serviceJson(); |
145 | 145 | } |
146 | 146 | |
@@ -165,9 +165,9 @@ discard block |
||
165 | 165 | * @param array $environment |
166 | 166 | * @return mixed|string |
167 | 167 | */ |
168 | - public function environment($environment=array()) |
|
168 | + public function environment($environment = array()) |
|
169 | 169 | { |
170 | - if($this->checkBindings(__FUNCTION__)){ |
|
170 | + if ($this->checkBindings(__FUNCTION__)) { |
|
171 | 171 | |
172 | 172 | $arguments = (isset(func_get_args()[0])) |
173 | 173 | ? func_get_args()[0] : func_get_args(); |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | $environmentContainer = $this['environment']; |
177 | 177 | |
178 | 178 | return $environmentContainer->environment( |
179 | - $arguments,$this['environmentVariables'] |
|
179 | + $arguments, $this['environmentVariables'] |
|
180 | 180 | ); |
181 | 181 | } |
182 | 182 | |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | public function isLocale() : bool |
209 | 209 | { |
210 | 210 | //check environment for local |
211 | - return $this->environment() === 'local'; |
|
211 | + return $this->environment()==='local'; |
|
212 | 212 | } |
213 | 213 | |
214 | 214 | /** |
@@ -222,14 +222,14 @@ discard block |
||
222 | 222 | |
223 | 223 | // with the help of reflection instance, |
224 | 224 | // we get the kernel properties extended with the application object. |
225 | - foreach ($this['reflection']($this)->getProperties() as $property){ |
|
225 | + foreach ($this['reflection']($this)->getProperties() as $property) { |
|
226 | 226 | $properties[] = $property->getName(); |
227 | 227 | } |
228 | 228 | |
229 | 229 | // we get the names of |
230 | 230 | // the kernel properties ended with groups through the Collection class. |
231 | - [$groups] = Collection::make($properties)->partition(function($properties){ |
|
232 | - return Str::endsWith($properties,'Groups'); |
|
231 | + [$groups] = Collection::make($properties)->partition(function($properties) { |
|
232 | + return Str::endsWith($properties, 'Groups'); |
|
233 | 233 | }); |
234 | 234 | |
235 | 235 | //as a result, kernel groups are being returned. |
@@ -246,8 +246,8 @@ discard block |
||
246 | 246 | $list = []; |
247 | 247 | |
248 | 248 | //get kernel group names with manifest method |
249 | - foreach ($this->kernelGroupKeys() as $groupKey){ |
|
250 | - $list = array_merge($list,$this->manifest($groupKey)); |
|
249 | + foreach ($this->kernelGroupKeys() as $groupKey) { |
|
250 | + $list = array_merge($list, $this->manifest($groupKey)); |
|
251 | 251 | } |
252 | 252 | |
253 | 253 | return $list; |
@@ -263,14 +263,14 @@ discard block |
||
263 | 263 | { |
264 | 264 | // it adds the values in path data specified |
265 | 265 | // by callback to the configuration values. |
266 | - if($this['config'] instanceof ConfigProviderContracts){ |
|
266 | + if ($this['config'] instanceof ConfigProviderContracts) { |
|
267 | 267 | |
268 | 268 | //set your path for config loader |
269 | - tap($this['config'],function(ConfigProviderContracts $config) use($callback) { |
|
269 | + tap($this['config'], function(ConfigProviderContracts $config) use($callback) { |
|
270 | 270 | $config->setConfig(call_user_func($callback)); |
271 | 271 | }); |
272 | 272 | } |
273 | - else{ |
|
273 | + else { |
|
274 | 274 | //set config instance exception for application |
275 | 275 | exception()->unexpectedValue('config instance is not loaded for application container'); |
276 | 276 | } |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | * @param array $loaders |
283 | 283 | * @return mixed|void |
284 | 284 | */ |
285 | - public function loadIfNotExistBoot($loaders=array()) |
|
285 | + public function loadIfNotExistBoot($loaders = array()) |
|
286 | 286 | { |
287 | 287 | //get kernel group list from application |
288 | 288 | $kernelGroupList = $this->kernelGroupList(); |
@@ -290,14 +290,14 @@ discard block |
||
290 | 290 | /** @var ClosureDispatcherContracts $closureBootLoader */ |
291 | 291 | $closureBootLoader = $this['closureBootLoader']; |
292 | 292 | |
293 | - foreach ($loaders as $loader){ |
|
293 | + foreach ($loaders as $loader) { |
|
294 | 294 | |
295 | 295 | // if a service needs another boot service, |
296 | 296 | // the service is directly installed here and the service needs are resolved. |
297 | - if(isset($kernelGroupList[$loader]) && $this->checkBindings($loader)===false){ |
|
297 | + if (isset($kernelGroupList[$loader]) && $this->checkBindings($loader)===false) { |
|
298 | 298 | |
299 | 299 | //with the boot loader kernel,we get the boot loader method. |
300 | - $closureBootLoader->call(function() use($loader,$kernelGroupList) { |
|
300 | + $closureBootLoader->call(function() use($loader, $kernelGroupList) { |
|
301 | 301 | |
302 | 302 | /** @var BootLoader $bootLoader */ |
303 | 303 | $bootLoader = $this; |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | $bootstrapper = $this['bootstrapper']; |
321 | 321 | |
322 | 322 | //kernel manifest bootstrapper |
323 | - return $bootstrapper->bootFire(null,$maker); |
|
323 | + return $bootstrapper->bootFire(null, $maker); |
|
324 | 324 | } |
325 | 325 | |
326 | 326 | /** |
@@ -331,7 +331,7 @@ discard block |
||
331 | 331 | public function runningInConsole() : bool |
332 | 332 | { |
333 | 333 | //Determine if the application is running in the console. |
334 | - return php_sapi_name() === 'cli' || php_sapi_name() === 'phpdbg'; |
|
334 | + return php_sapi_name()==='cli' || php_sapi_name()==='phpdbg'; |
|
335 | 335 | } |
336 | 336 | |
337 | 337 | /** |
@@ -347,7 +347,7 @@ discard block |
||
347 | 347 | : []; |
348 | 348 | |
349 | 349 | //core kernel providers and project providers have been merged |
350 | - return array_merge($this->manifest('providers'),$providers); |
|
350 | + return array_merge($this->manifest('providers'), $providers); |
|
351 | 351 | } |
352 | 352 | |
353 | 353 | /** |
@@ -357,12 +357,12 @@ discard block |
||
357 | 357 | * @param string $path |
358 | 358 | * @return mixed|void |
359 | 359 | */ |
360 | - public function setPaths($name,$path) |
|
360 | + public function setPaths($name, $path) |
|
361 | 361 | { |
362 | 362 | // save the globally identified paths to |
363 | 363 | // the global container object of the resta. |
364 | - if(file_exists($path)){ |
|
365 | - $this->register('paths',$name,$path); |
|
364 | + if (file_exists($path)) { |
|
365 | + $this->register('paths', $name, $path); |
|
366 | 366 | } |
367 | 367 | } |
368 | 368 |
@@ -20,34 +20,34 @@ |
||
20 | 20 | { |
21 | 21 | $serviceJson = app()->containerCacheFile(); |
22 | 22 | |
23 | - if(file_exists($serviceJson)){ |
|
23 | + if (file_exists($serviceJson)) { |
|
24 | 24 | JsonHandler::$file = $serviceJson; |
25 | 25 | $serviceJson = JsonHandler::get(); |
26 | 26 | |
27 | - $dottedKey = explode('.',$key); |
|
27 | + $dottedKey = explode('.', $key); |
|
28 | 28 | |
29 | - if(count($dottedKey)==2){ |
|
29 | + if (count($dottedKey)==2) { |
|
30 | 30 | |
31 | - if(isset($serviceJson['container'][$dottedKey[0]][$dottedKey[1]])){ |
|
31 | + if (isset($serviceJson['container'][$dottedKey[0]][$dottedKey[1]])) { |
|
32 | 32 | $arrayData = $serviceJson['container'][$dottedKey[0]][$dottedKey[1]]; |
33 | 33 | |
34 | - if($serviceJson['container-format'][$dottedKey[0]][$dottedKey[1]]=='string'){ |
|
34 | + if ($serviceJson['container-format'][$dottedKey[0]][$dottedKey[1]]=='string') { |
|
35 | 35 | return $arrayData; |
36 | 36 | } |
37 | 37 | |
38 | - if($serviceJson['container-format'][$dottedKey[0]][$dottedKey[1]]=='closure'){ |
|
38 | + if ($serviceJson['container-format'][$dottedKey[0]][$dottedKey[1]]=='closure') { |
|
39 | 39 | return SuperClosure::get($arrayData); |
40 | 40 | } |
41 | 41 | } |
42 | 42 | } |
43 | - else{ |
|
43 | + else { |
|
44 | 44 | |
45 | - if(isset($serviceJson['container'][$key])){ |
|
46 | - if($serviceJson['container-format'][$key]=='string'){ |
|
45 | + if (isset($serviceJson['container'][$key])) { |
|
46 | + if ($serviceJson['container-format'][$key]=='string') { |
|
47 | 47 | return $serviceJson['container'][$key]; |
48 | 48 | } |
49 | 49 | |
50 | - if($serviceJson['container-format'][$key]=='closure'){ |
|
50 | + if ($serviceJson['container-format'][$key]=='closure') { |
|
51 | 51 | return SuperClosure::get($serviceJson['container'][$key]); |
52 | 52 | } |
53 | 53 | } |
@@ -26,11 +26,11 @@ discard block |
||
26 | 26 | * |
27 | 27 | * @throws FileNotFoundException |
28 | 28 | */ |
29 | - private function applyProvider($key,$provider,$method='register') |
|
29 | + private function applyProvider($key, $provider, $method = 'register') |
|
30 | 30 | { |
31 | 31 | // If the provider classes are a real object |
32 | 32 | // we will run them. |
33 | - if(Utils::isNamespaceExists($provider)){ |
|
33 | + if (Utils::isNamespaceExists($provider)) { |
|
34 | 34 | |
35 | 35 | // after determining whether the register or boot methods |
36 | 36 | // we are running the provider. |
@@ -38,13 +38,13 @@ discard block |
||
38 | 38 | $providerInstance = $this->app->resolve($provider); |
39 | 39 | |
40 | 40 | //we need to do method check for provider. |
41 | - if(method_exists($providerInstance,$method)){ |
|
41 | + if (method_exists($providerInstance, $method)) { |
|
42 | 42 | $providerInstance->{$method}(); |
43 | 43 | |
44 | - if($method=="register"){ |
|
44 | + if ($method=="register") { |
|
45 | 45 | /** @scrutinizer ignore-call */ |
46 | - $this->app->register('loadedProviders',$key,$provider); |
|
47 | - $this->deferrableProvider($providerInstance,$provider); |
|
46 | + $this->app->register('loadedProviders', $key, $provider); |
|
47 | + $this->deferrableProvider($providerInstance, $provider); |
|
48 | 48 | } |
49 | 49 | } |
50 | 50 | } |
@@ -58,58 +58,58 @@ discard block |
||
58 | 58 | * |
59 | 59 | * @throws FileNotFoundException |
60 | 60 | */ |
61 | - private function deferrableProvider($providerInstance,$provider) |
|
61 | + private function deferrableProvider($providerInstance, $provider) |
|
62 | 62 | { |
63 | 63 | $serviceJson = $this->app->containerCacheFile(); |
64 | 64 | |
65 | - if($providerInstance instanceof DeferrableProvider && file_exists($serviceJson)){ |
|
65 | + if ($providerInstance instanceof DeferrableProvider && file_exists($serviceJson)) { |
|
66 | 66 | $deferrableProvides = $providerInstance->provides(); |
67 | 67 | |
68 | 68 | foreach ($deferrableProvides as $deferrableProvide) { |
69 | - if($this->app->has($deferrableProvide)){ |
|
69 | + if ($this->app->has($deferrableProvide)) { |
|
70 | 70 | JsonHandler::$file = $serviceJson; |
71 | 71 | $serviceJson = JsonHandler::get(); |
72 | 72 | |
73 | - if(!isset($serviceJson['providers'][$provider])){ |
|
74 | - JsonHandler::set('providers-deferrable-classes',[ |
|
73 | + if (!isset($serviceJson['providers'][$provider])) { |
|
74 | + JsonHandler::set('providers-deferrable-classes', [ |
|
75 | 75 | $provider => true |
76 | 76 | ]); |
77 | 77 | |
78 | 78 | $container = $this->app->get($deferrableProvide); |
79 | 79 | |
80 | - if(!is_array($container)){ |
|
80 | + if (!is_array($container)) { |
|
81 | 81 | |
82 | - if($container instanceof \Closure){ |
|
83 | - JsonHandler::set('container',[ |
|
82 | + if ($container instanceof \Closure) { |
|
83 | + JsonHandler::set('container', [ |
|
84 | 84 | $deferrableProvide => SuperClosure::set($container) |
85 | 85 | ]); |
86 | 86 | |
87 | - JsonHandler::set('container-format',[ |
|
87 | + JsonHandler::set('container-format', [ |
|
88 | 88 | $deferrableProvide => 'closure' |
89 | 89 | ]); |
90 | 90 | } |
91 | - else{ |
|
92 | - JsonHandler::set('container',[ |
|
91 | + else { |
|
92 | + JsonHandler::set('container', [ |
|
93 | 93 | $deferrableProvide => $container |
94 | 94 | ]); |
95 | 95 | |
96 | - JsonHandler::set('container-format',[ |
|
96 | + JsonHandler::set('container-format', [ |
|
97 | 97 | $deferrableProvide => 'string' |
98 | 98 | ]); |
99 | 99 | } |
100 | 100 | |
101 | 101 | } |
102 | - else{ |
|
102 | + else { |
|
103 | 103 | foreach ($container as $containerKey=>$containerItem) { |
104 | - if($containerItem instanceof \Closure){ |
|
105 | - JsonHandler::set('container.'.$deferrableProvide.'.'.$containerKey.'',SuperClosure::set($containerItem)); |
|
104 | + if ($containerItem instanceof \Closure) { |
|
105 | + JsonHandler::set('container.'.$deferrableProvide.'.'.$containerKey.'', SuperClosure::set($containerItem)); |
|
106 | 106 | |
107 | - JsonHandler::set('container-format.'.$deferrableProvide.'.'.$containerKey,'closure'); |
|
107 | + JsonHandler::set('container-format.'.$deferrableProvide.'.'.$containerKey, 'closure'); |
|
108 | 108 | } |
109 | - else{ |
|
110 | - JsonHandler::set('container.'.$deferrableProvide.'.'.$containerKey.'',$containerItem); |
|
109 | + else { |
|
110 | + JsonHandler::set('container.'.$deferrableProvide.'.'.$containerKey.'', $containerItem); |
|
111 | 111 | |
112 | - JsonHandler::set('container-format.'.$deferrableProvide.'.'.$containerKey,'string'); |
|
112 | + JsonHandler::set('container-format.'.$deferrableProvide.'.'.$containerKey, 'string'); |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | } |
@@ -128,12 +128,12 @@ discard block |
||
128 | 128 | */ |
129 | 129 | private function assignerLoadedProvidersInitialCoreValue() |
130 | 130 | { |
131 | - if(!isset($this->app['loadedProviders'])){ |
|
131 | + if (!isset($this->app['loadedProviders'])) { |
|
132 | 132 | |
133 | 133 | // for loaded providers, |
134 | 134 | // we register an empty array for the container object. |
135 | 135 | /** @scrutinizer ignore-call */ |
136 | - $this->app->register('loadedProviders',[]); |
|
136 | + $this->app->register('loadedProviders', []); |
|
137 | 137 | } |
138 | 138 | } |
139 | 139 | |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | /** @scrutinizer ignore-call */ |
149 | 149 | $providers = $this->app->serviceProviders(); |
150 | 150 | |
151 | - if(count($providers)){ |
|
151 | + if (count($providers)) { |
|
152 | 152 | $this->providers = $providers; |
153 | 153 | } |
154 | 154 | |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | */ |
163 | 163 | public function handle() |
164 | 164 | { |
165 | - define ('serviceprovider',true); |
|
165 | + define('serviceprovider', true); |
|
166 | 166 | |
167 | 167 | //check providers and resolve |
168 | 168 | $this->resolveProviders($this->getServiceProviders()); |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | * |
176 | 176 | * @throws FileNotFoundException |
177 | 177 | */ |
178 | - public function resolveProviders($providers=array()) |
|
178 | + public function resolveProviders($providers = array()) |
|
179 | 179 | { |
180 | 180 | // for loaded providers, |
181 | 181 | // we register an empty array for the container object. |
@@ -184,36 +184,36 @@ discard block |
||
184 | 184 | $serviceJson = []; |
185 | 185 | |
186 | 186 | //first we are running register methods of provider classes. |
187 | - foreach($providers as $key=>$provider){ |
|
187 | + foreach ($providers as $key=>$provider) { |
|
188 | 188 | |
189 | - if(file_exists($this->app->containerCacheFile())){ |
|
189 | + if (file_exists($this->app->containerCacheFile())) { |
|
190 | 190 | JsonHandler::$file = $this->app->containerCacheFile(); |
191 | 191 | $serviceJson = JsonHandler::get(); |
192 | 192 | } |
193 | 193 | |
194 | 194 | // providers can only be installed once. |
195 | 195 | // apply providers and register for kernel |
196 | - if(!isset($this->app['loadedProviders'][$key])){ |
|
196 | + if (!isset($this->app['loadedProviders'][$key])) { |
|
197 | 197 | |
198 | - if(is_array($provider) && isset($provider['status']) && $provider['status']){ |
|
199 | - if(!isset($serviceJson['providers-deferrable-classes'][$provider['class']])){ |
|
200 | - $this->applyProvider($key,$provider['class']); |
|
198 | + if (is_array($provider) && isset($provider['status']) && $provider['status']) { |
|
199 | + if (!isset($serviceJson['providers-deferrable-classes'][$provider['class']])) { |
|
200 | + $this->applyProvider($key, $provider['class']); |
|
201 | 201 | } |
202 | 202 | |
203 | 203 | } |
204 | - else{ |
|
205 | - $this->applyProvider($key,$provider); |
|
204 | + else { |
|
205 | + $this->applyProvider($key, $provider); |
|
206 | 206 | } |
207 | 207 | |
208 | 208 | } |
209 | 209 | } |
210 | 210 | |
211 | 211 | //then we are running boot methods of provider classes. |
212 | - foreach($providers as $key=>$provider){ |
|
212 | + foreach ($providers as $key=>$provider) { |
|
213 | 213 | |
214 | 214 | //if the providers register is already booted. |
215 | - if(isset($this->app['loadedProviders'][$key])){ |
|
216 | - $this->applyProvider($key,$provider,'boot'); |
|
215 | + if (isset($this->app['loadedProviders'][$key])) { |
|
216 | + $this->applyProvider($key, $provider, 'boot'); |
|
217 | 217 | } |
218 | 218 | } |
219 | 219 | } |