@@ -21,7 +21,7 @@ |
||
21 | 21 | */ |
22 | 22 | private static function getInstance() |
23 | 23 | { |
24 | - if(is_null(self::$singleton)){ |
|
24 | + if (is_null(self::$singleton)) { |
|
25 | 25 | self::$singleton = new Serializer(); |
26 | 26 | } |
27 | 27 |
@@ -26,29 +26,29 @@ 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. |
37 | 37 | /** @scrutinizer ignore-call */ |
38 | - if($this->app->runningInConsole()===false){ |
|
38 | + if ($this->app->runningInConsole()===false) { |
|
39 | 39 | $providerInstance = $this->checkInServiceJsonForProvider($provider); |
40 | 40 | } |
41 | - else{ |
|
41 | + else { |
|
42 | 42 | $providerInstance = $this->app->resolve($provider); |
43 | 43 | } |
44 | 44 | |
45 | 45 | //we need to do method check for provider. |
46 | - if(method_exists($providerInstance,$method)){ |
|
46 | + if (method_exists($providerInstance, $method)) { |
|
47 | 47 | $providerInstance->{$method}(); |
48 | 48 | |
49 | - if($method=="register"){ |
|
49 | + if ($method=="register") { |
|
50 | 50 | /** @scrutinizer ignore-call */ |
51 | - $this->app->register('loadedProviders',$key,$provider); |
|
51 | + $this->app->register('loadedProviders', $key, $provider); |
|
52 | 52 | } |
53 | 53 | } |
54 | 54 | } |
@@ -61,12 +61,12 @@ discard block |
||
61 | 61 | */ |
62 | 62 | private function assignerLoadedProvidersInitialCoreValue() |
63 | 63 | { |
64 | - if(!isset($this->app['loadedProviders'])){ |
|
64 | + if (!isset($this->app['loadedProviders'])) { |
|
65 | 65 | |
66 | 66 | // for loaded providers, |
67 | 67 | // we register an empty array for the container object. |
68 | 68 | /** @scrutinizer ignore-call */ |
69 | - $this->app->register('loadedProviders',[]); |
|
69 | + $this->app->register('loadedProviders', []); |
|
70 | 70 | } |
71 | 71 | } |
72 | 72 | |
@@ -83,13 +83,13 @@ discard block |
||
83 | 83 | JsonHandler::$file = serviceJson(); |
84 | 84 | $data = JsonHandler::get(); |
85 | 85 | |
86 | - if(!isset($data['providers'][$provider])){ |
|
87 | - $serviceRegister = JsonHandler::set('providers',[$provider=>SerializeClassProcess::set($provider)]); |
|
86 | + if (!isset($data['providers'][$provider])) { |
|
87 | + $serviceRegister = JsonHandler::set('providers', [$provider=>SerializeClassProcess::set($provider)]); |
|
88 | 88 | } |
89 | 89 | |
90 | - if(isset($serviceRegister)){ |
|
90 | + if (isset($serviceRegister)) { |
|
91 | 91 | $data = JsonHandler::get(); |
92 | - if(!isset($data['providers'][$provider])){ |
|
92 | + if (!isset($data['providers'][$provider])) { |
|
93 | 93 | return $this->app->resolve($provider); |
94 | 94 | } |
95 | 95 | } |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | /** @scrutinizer ignore-call */ |
109 | 109 | $providers = $this->app->serviceProviders(); |
110 | 110 | |
111 | - if(count($providers)){ |
|
111 | + if (count($providers)) { |
|
112 | 112 | $this->providers = $providers; |
113 | 113 | } |
114 | 114 | |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | */ |
123 | 123 | public function handle() |
124 | 124 | { |
125 | - define ('serviceprovider',true); |
|
125 | + define('serviceprovider', true); |
|
126 | 126 | |
127 | 127 | //check providers and resolve |
128 | 128 | $this->resolveProviders($this->getServiceProviders()); |
@@ -135,28 +135,28 @@ discard block |
||
135 | 135 | * |
136 | 136 | * @throws FileNotFoundException |
137 | 137 | */ |
138 | - public function resolveProviders($providers=array()) |
|
138 | + public function resolveProviders($providers = array()) |
|
139 | 139 | { |
140 | 140 | // for loaded providers, |
141 | 141 | // we register an empty array for the container object. |
142 | 142 | $this->assignerLoadedProvidersInitialCoreValue(); |
143 | 143 | |
144 | 144 | //first we are running register methods of provider classes. |
145 | - foreach($providers as $key=>$provider){ |
|
145 | + foreach ($providers as $key=>$provider) { |
|
146 | 146 | |
147 | 147 | // providers can only be installed once. |
148 | 148 | // apply providers and register for kernel |
149 | - if(!isset($this->app['loadedProviders'][$key])){ |
|
150 | - $this->applyProvider($key,$provider); |
|
149 | + if (!isset($this->app['loadedProviders'][$key])) { |
|
150 | + $this->applyProvider($key, $provider); |
|
151 | 151 | } |
152 | 152 | } |
153 | 153 | |
154 | 154 | //then we are running boot methods of provider classes. |
155 | - foreach($providers as $key=>$provider){ |
|
155 | + foreach ($providers as $key=>$provider) { |
|
156 | 156 | |
157 | 157 | //if the providers register is already booted. |
158 | - if(isset($this->app['loadedProviders'][$key])){ |
|
159 | - $this->applyProvider($key,$provider,'boot'); |
|
158 | + if (isset($this->app['loadedProviders'][$key])) { |
|
159 | + $this->applyProvider($key, $provider, 'boot'); |
|
160 | 160 | } |
161 | 161 | } |
162 | 162 | } |
@@ -37,8 +37,7 @@ |
||
37 | 37 | /** @scrutinizer ignore-call */ |
38 | 38 | if($this->app->runningInConsole()===false){ |
39 | 39 | $providerInstance = $this->checkInServiceJsonForProvider($provider); |
40 | - } |
|
41 | - else{ |
|
40 | + } else{ |
|
42 | 41 | $providerInstance = $this->app->resolve($provider); |
43 | 42 | } |
44 | 43 |
@@ -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 |