@@ -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,14 +177,14 @@ 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 | - if(isset($params['key'])){
|
|
| 183 | - app()->register('errorInput',$params['key']);
|
|
| 182 | + if (isset($params['key'])) {
|
|
| 183 | + app()->register('errorInput', $params['key']);
|
|
| 184 | 184 | } |
| 185 | 185 | |
| 186 | - $exceptionManager=ExceptionManager::class; |
|
| 187 | - return app()->resolve($exceptionManager,['name'=>$name,'params'=>$params]); |
|
| 186 | + $exceptionManager = ExceptionManager::class; |
|
| 187 | + return app()->resolve($exceptionManager, ['name'=>$name, 'params'=>$params]); |
|
| 188 | 188 | } |
| 189 | 189 | } |
| 190 | 190 | |
@@ -194,13 +194,13 @@ discard block |
||
| 194 | 194 | * @param null $locale |
| 195 | 195 | * @return Generator |
| 196 | 196 | */ |
| 197 | - function faker($locale=null) |
|
| 197 | + function faker($locale = null) |
|
| 198 | 198 | {
|
| 199 | - if($locale===null){
|
|
| 200 | - $faker=Factory::create(); |
|
| 199 | + if ($locale===null) {
|
|
| 200 | + $faker = Factory::create(); |
|
| 201 | 201 | } |
| 202 | - else{
|
|
| 203 | - $faker=Factory::create($locale); |
|
| 202 | + else {
|
|
| 203 | + $faker = Factory::create($locale); |
|
| 204 | 204 | } |
| 205 | 205 | |
| 206 | 206 | return $faker; |
@@ -211,8 +211,8 @@ discard block |
||
| 211 | 211 | |
| 212 | 212 | function fingerPrint() |
| 213 | 213 | {
|
| 214 | - return md5(sha1(implode("|",[
|
|
| 215 | - request()->getClientIp(),applicationKey() |
|
| 214 | + return md5(sha1(implode("|", [
|
|
| 215 | + request()->getClientIp(), applicationKey() |
|
| 216 | 216 | ]))); |
| 217 | 217 | } |
| 218 | 218 | } |
@@ -232,10 +232,10 @@ discard block |
||
| 232 | 232 | * @param null $default |
| 233 | 233 | * @return null |
| 234 | 234 | */ |
| 235 | - function get($param=null,$default=null) |
|
| 235 | + function get($param = null, $default = null) |
|
| 236 | 236 | {
|
| 237 | 237 | //symfony request query object |
| 238 | - $get=core()->get; |
|
| 238 | + $get = core()->get; |
|
| 239 | 239 | |
| 240 | 240 | return ($param===null) ? $get : (isset($get[$param]) ? $get[$param] : $default); |
| 241 | 241 | } |
@@ -248,14 +248,14 @@ discard block |
||
| 248 | 248 | * @param null $default |
| 249 | 249 | * @return array|string |
| 250 | 250 | */ |
| 251 | - function headers($param=null,$default=null) |
|
| 251 | + function headers($param = null, $default = null) |
|
| 252 | 252 | {
|
| 253 | - $list=[]; |
|
| 253 | + $list = []; |
|
| 254 | 254 | |
| 255 | 255 | //We only get the objects in the list name to match the header objects |
| 256 | 256 | //that come with the request path to the objects sent by the client |
| 257 | 257 | foreach (request()->headers->all() as $key=>$value) {
|
| 258 | - $list[$key]=$value; |
|
| 258 | + $list[$key] = $value; |
|
| 259 | 259 | } |
| 260 | 260 | |
| 261 | 261 | //return header list |
@@ -280,9 +280,9 @@ discard block |
||
| 280 | 280 | * @param $file null |
| 281 | 281 | * @return LoggerHandler |
| 282 | 282 | */ |
| 283 | - function logger($file=null) |
|
| 283 | + function logger($file = null) |
|
| 284 | 284 | {
|
| 285 | - return app()->resolve(LoggerHandler::class,['file'=>$file]); |
|
| 285 | + return app()->resolve(LoggerHandler::class, ['file'=>$file]); |
|
| 286 | 286 | } |
| 287 | 287 | } |
| 288 | 288 | |
@@ -304,7 +304,7 @@ discard block |
||
| 304 | 304 | */ |
| 305 | 305 | function response() |
| 306 | 306 | {
|
| 307 | - $object=debug_backtrace()[1]['object']; |
|
| 307 | + $object = debug_backtrace()[1]['object']; |
|
| 308 | 308 | return new ResponseOutManager($object); |
| 309 | 309 | } |
| 310 | 310 | } |
@@ -319,9 +319,9 @@ discard block |
||
| 319 | 319 | * @throws \DI\DependencyException |
| 320 | 320 | * @throws \DI\NotFoundException |
| 321 | 321 | */ |
| 322 | - function resolve($class,$bind=array()) |
|
| 322 | + function resolve($class, $bind = array()) |
|
| 323 | 323 | {
|
| 324 | - return app()->resolve($class,$bind); |
|
| 324 | + return app()->resolve($class, $bind); |
|
| 325 | 325 | } |
| 326 | 326 | } |
| 327 | 327 | |
@@ -332,7 +332,7 @@ discard block |
||
| 332 | 332 | */ |
| 333 | 333 | function policy() |
| 334 | 334 | {
|
| 335 | - $policyPath = implode('/',[
|
|
| 335 | + $policyPath = implode('/', [
|
|
| 336 | 336 | Route::getRouteControllerNamespace(), |
| 337 | 337 | 'Policy', |
| 338 | 338 | Route::getRouteControllerClass().'Policy' |
@@ -340,7 +340,7 @@ discard block |
||
| 340 | 340 | |
| 341 | 341 | $policyNamespace = Utils::getNamespace($policyPath); |
| 342 | 342 | |
| 343 | - if(Utils::isNamespaceExists($policyNamespace)){
|
|
| 343 | + if (Utils::isNamespaceExists($policyNamespace)) {
|
|
| 344 | 344 | return app()->resolve(Utils::getNamespace($policyPath)); |
| 345 | 345 | } |
| 346 | 346 | |
@@ -355,10 +355,10 @@ discard block |
||
| 355 | 355 | * @param $key |
| 356 | 356 | * @return mixed |
| 357 | 357 | */ |
| 358 | - function route($key=null) |
|
| 358 | + function route($key = null) |
|
| 359 | 359 | {
|
| 360 | - if(is_null($key)){
|
|
| 361 | - return array_map(function($route){
|
|
| 360 | + if (is_null($key)) {
|
|
| 361 | + return array_map(function($route) {
|
|
| 362 | 362 | return strtolower($route); |
| 363 | 363 | },app()->singleton()->appClass->route($key)); |
| 364 | 364 | } |
@@ -386,10 +386,10 @@ discard block |
||
| 386 | 386 | * @param null $default |
| 387 | 387 | * @return mixed |
| 388 | 388 | */ |
| 389 | - function post($param=null,$default=null) |
|
| 389 | + function post($param = null, $default = null) |
|
| 390 | 390 | {
|
| 391 | 391 | //symfony request query object |
| 392 | - $post=core()->post; |
|
| 392 | + $post = core()->post; |
|
| 393 | 393 | |
| 394 | 394 | return ($param===null) ? $post : (isset($post[$param]) ? $post[$param] : $default); |
| 395 | 395 | } |
@@ -420,9 +420,9 @@ discard block |
||
| 420 | 420 | * @param array $select |
| 421 | 421 | * @return mixed |
| 422 | 422 | */ |
| 423 | - function trans($lang,$select=array()) |
|
| 423 | + function trans($lang, $select = array()) |
|
| 424 | 424 | {
|
| 425 | - return app()->singleton()->appClass->translator($lang,$select); |
|
| 425 | + return app()->singleton()->appClass->translator($lang, $select); |
|
| 426 | 426 | } |
| 427 | 427 | } |
| 428 | 428 | |
@@ -435,7 +435,7 @@ discard block |
||
| 435 | 435 | {
|
| 436 | 436 | $file = app()->path()->kernel().''.DIRECTORY_SEPARATOR.'service.json'; |
| 437 | 437 | |
| 438 | - if(file_exists($file)){
|
|
| 438 | + if (file_exists($file)) {
|
|
| 439 | 439 | return $file; |
| 440 | 440 | } |
| 441 | 441 | |