@@ -24,29 +24,29 @@ discard block |
||
| 24 | 24 | * @param $arg |
| 25 | 25 | * @return mixed |
| 26 | 26 | */ |
| 27 | - public static function annotationsLoaders($service,$arg) |
|
| 27 | + public static function annotationsLoaders($service, $arg) |
|
| 28 | 28 | {
|
| 29 | 29 | //factory runner |
| 30 | - if($service=="factory"){
|
|
| 30 | + if ($service=="factory") {
|
|
| 31 | 31 | return self::factory(); |
| 32 | 32 | } |
| 33 | 33 | //if $name starts with $needles for repository |
| 34 | - if(Str::endsWith($service,'Repository')){
|
|
| 34 | + if (Str::endsWith($service, 'Repository')) {
|
|
| 35 | 35 | return self::repository($service); |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | //if $name starts with $needles for source |
| 39 | - if(Str::endsWith($service,'Source')){
|
|
| 40 | - return self::source($service,$arg); |
|
| 39 | + if (Str::endsWith($service, 'Source')) {
|
|
| 40 | + return self::source($service, $arg); |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | //if $name starts with $needles for model |
| 44 | - if(Str::endsWith($service,'Builder')){
|
|
| 44 | + if (Str::endsWith($service, 'Builder')) {
|
|
| 45 | 45 | return self::Builder(ucfirst($service)); |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | |
| 49 | - if(method_exists(new self,$service)){
|
|
| 49 | + if (method_exists(new self, $service)) {
|
|
| 50 | 50 | return self::$service($arg); |
| 51 | 51 | } |
| 52 | 52 | |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | private static function builder($service) |
| 76 | 76 | {
|
| 77 | 77 | //we are making a namespace assignment for the builder. |
| 78 | - $builder=app()->namespace()->builder().'\\'.$service; |
|
| 78 | + $builder = app()->namespace()->builder().'\\'.$service; |
|
| 79 | 79 | |
| 80 | 80 | //we are getting builder instance. |
| 81 | 81 | return app()->resolve($builder); |
@@ -103,16 +103,16 @@ discard block |
||
| 103 | 103 | * @param array $bind |
| 104 | 104 | * @return mixed |
| 105 | 105 | */ |
| 106 | - public function container($instance,$class,$bind=array()) |
|
| 106 | + public function container($instance, $class, $bind = array()) |
|
| 107 | 107 | {
|
| 108 | - if(!property_exists($instance->container(),$class)){
|
|
| 108 | + if (!property_exists($instance->container(), $class)) {
|
|
| 109 | 109 | throw new \InvalidArgumentException('container object false for ('.$class.') object');
|
| 110 | 110 | } |
| 111 | 111 | |
| 112 | - $container=$instance->container()->{$class};
|
|
| 112 | + $container = $instance->container()->{$class};
|
|
| 113 | 113 | |
| 114 | - if(!is_array($instance->container()->{$class}) AND Utils::isNamespaceExists($container)){
|
|
| 115 | - return $instance->resolve($container,$bind); |
|
| 114 | + if (!is_array($instance->container()->{$class}) AND Utils::isNamespaceExists($container)) {
|
|
| 115 | + return $instance->resolve($container, $bind); |
|
| 116 | 116 | } |
| 117 | 117 | return $instance->container()->{$class};
|
| 118 | 118 | } |
@@ -122,8 +122,8 @@ discard block |
||
| 122 | 122 | */ |
| 123 | 123 | public function createAppInstance($object) |
| 124 | 124 | {
|
| 125 | - if(!defined('appInstance')){
|
|
| 126 | - define('appInstance',(base64_encode(serialize($object))));
|
|
| 125 | + if (!defined('appInstance')) {
|
|
| 126 | + define('appInstance', (base64_encode(serialize($object))));
|
|
| 127 | 127 | } |
| 128 | 128 | } |
| 129 | 129 | |
@@ -131,9 +131,9 @@ discard block |
||
| 131 | 131 | * @param array $arg |
| 132 | 132 | * @return mixed |
| 133 | 133 | */ |
| 134 | - private static function date($arg=array()) |
|
| 134 | + private static function date($arg = array()) |
|
| 135 | 135 | {
|
| 136 | - $locale = (count($arg)=="0") ? config('app.locale','en') : current($arg);
|
|
| 136 | + $locale = (count($arg)=="0") ? config('app.locale', 'en') : current($arg);
|
|
| 137 | 137 | |
| 138 | 138 | return app()->resolve(Date::class)->setLocale($locale); |
| 139 | 139 | } |
@@ -153,8 +153,8 @@ discard block |
||
| 153 | 153 | {
|
| 154 | 154 | //we save an instance for the entire application |
| 155 | 155 | //and add it to the helper file to be accessed from anywhere in the application. |
| 156 | - if(!isset(self::$instance['appInstance'])){
|
|
| 157 | - self::$instance['appInstance']=unserialize(base64_decode(appInstance)); |
|
| 156 | + if (!isset(self::$instance['appInstance'])) {
|
|
| 157 | + self::$instance['appInstance'] = unserialize(base64_decode(appInstance)); |
|
| 158 | 158 | return self::$instance['appInstance']; |
| 159 | 159 | } |
| 160 | 160 | return self::$instance['appInstance']; |
@@ -181,9 +181,9 @@ discard block |
||
| 181 | 181 | */ |
| 182 | 182 | private static function queue() |
| 183 | 183 | {
|
| 184 | - if(!isset(self::$instance['queue'])){
|
|
| 184 | + if (!isset(self::$instance['queue'])) {
|
|
| 185 | 185 | |
| 186 | - self::$instance['queue']=(new Queue()); |
|
| 186 | + self::$instance['queue'] = (new Queue()); |
|
| 187 | 187 | return self::$instance['queue']; |
| 188 | 188 | |
| 189 | 189 | } |
@@ -195,18 +195,18 @@ discard block |
||
| 195 | 195 | * @param bool $namespace |
| 196 | 196 | * @return string |
| 197 | 197 | */ |
| 198 | - public static function repository($service,$namespace=false) |
|
| 198 | + public static function repository($service, $namespace = false) |
|
| 199 | 199 | {
|
| 200 | 200 | //I can get the repository name from the magic method as a salt repository, |
| 201 | 201 | //after which we will edit it as an adapter namespace. |
| 202 | - $repositoryName=ucfirst(preg_replace('@Repository@is','',$service));
|
|
| 202 | + $repositoryName = ucfirst(preg_replace('@Repository@is', '', $service));
|
|
| 203 | 203 | |
| 204 | 204 | //If we then configure the name of the simple repository to be an adapter |
| 205 | 205 | //then we will give the user an example of the adapter class in each repository call. |
| 206 | 206 | $repositoryAdapterName = $repositoryName.'Adapter'; |
| 207 | 207 | $repositoryNamespace = app()->namespace()->repository().'\\'.$repositoryName.'\\'.$repositoryAdapterName; |
| 208 | 208 | |
| 209 | - if($namespace) return $repositoryNamespace; |
|
| 209 | + if ($namespace) return $repositoryNamespace; |
|
| 210 | 210 | |
| 211 | 211 | //and eventually we conclude the adapter class of the repository package as an instance. |
| 212 | 212 | return app()->resolve($repositoryNamespace)->adapter(); |
@@ -217,17 +217,17 @@ discard block |
||
| 217 | 217 | * @param $arg |
| 218 | 218 | * @return mixed |
| 219 | 219 | */ |
| 220 | - private static function source($service,$arg) |
|
| 220 | + private static function source($service, $arg) |
|
| 221 | 221 | {
|
| 222 | 222 | //get Source path |
| 223 | - $service=ucfirst($service); |
|
| 224 | - $getCalledClass=str_replace('\\'.class_basename($arg[0]),'',get_class($arg[0]));
|
|
| 225 | - $getCalledClass=class_basename($getCalledClass); |
|
| 223 | + $service = ucfirst($service); |
|
| 224 | + $getCalledClass = str_replace('\\'.class_basename($arg[0]), '', get_class($arg[0]));
|
|
| 225 | + $getCalledClass = class_basename($getCalledClass); |
|
| 226 | 226 | |
| 227 | - $service=str_replace($getCalledClass,'',$service); |
|
| 227 | + $service = str_replace($getCalledClass, '', $service); |
|
| 228 | 228 | |
| 229 | 229 | //run service for endpoint |
| 230 | - $serviceSource=StaticPathModel::appSourceEndpoint().'\\'.$getCalledClass.'\\'.$service.'\Main'; |
|
| 230 | + $serviceSource = StaticPathModel::appSourceEndpoint().'\\'.$getCalledClass.'\\'.$service.'\Main'; |
|
| 231 | 231 | return app()->resolve($serviceSource); |
| 232 | 232 | } |
| 233 | 233 | |
@@ -236,9 +236,9 @@ discard block |
||
| 236 | 236 | */ |
| 237 | 237 | public static function redis() |
| 238 | 238 | {
|
| 239 | - if(!isset(self::$instance['redis'])){
|
|
| 239 | + if (!isset(self::$instance['redis'])) {
|
|
| 240 | 240 | |
| 241 | - self::$instance['redis']=(new Redis())->client(); |
|
| 241 | + self::$instance['redis'] = (new Redis())->client(); |
|
| 242 | 242 | return self::$instance['redis']; |
| 243 | 243 | |
| 244 | 244 | } |
@@ -249,13 +249,13 @@ discard block |
||
| 249 | 249 | * @param null $param |
| 250 | 250 | * @return array|null|string |
| 251 | 251 | */ |
| 252 | - public function route($param=null) |
|
| 252 | + public function route($param = null) |
|
| 253 | 253 | {
|
| 254 | - $kernel=self::getAppInstance()->kernel; |
|
| 254 | + $kernel = self::getAppInstance()->kernel; |
|
| 255 | 255 | |
| 256 | - $saltRouteParameters=$kernel->routeParameters; |
|
| 256 | + $saltRouteParameters = $kernel->routeParameters; |
|
| 257 | 257 | |
| 258 | - if($param===null){
|
|
| 258 | + if ($param===null) {
|
|
| 259 | 259 | return $saltRouteParameters; |
| 260 | 260 | } |
| 261 | 261 | |
@@ -271,14 +271,14 @@ discard block |
||
| 271 | 271 | * @param array $select |
| 272 | 272 | * @return mixed|string |
| 273 | 273 | */ |
| 274 | - public function translator($data,$select=array()) |
|
| 274 | + public function translator($data, $select = array()) |
|
| 275 | 275 | {
|
| 276 | - $lang=(new Lingua(path()->appLanguage())); |
|
| 276 | + $lang = (new Lingua(path()->appLanguage())); |
|
| 277 | 277 | |
| 278 | - $defaultLocale=config('app.locale');
|
|
| 278 | + $defaultLocale = config('app.locale');
|
|
| 279 | 279 | |
| 280 | - if(count($select)){
|
|
| 281 | - return $lang->include(['default'])->locale($defaultLocale)->get($data,$select); |
|
| 280 | + if (count($select)) {
|
|
| 281 | + return $lang->include(['default'])->locale($defaultLocale)->get($data, $select); |
|
| 282 | 282 | } |
| 283 | 283 | |
| 284 | 284 | return $lang->include(['default'])->locale($defaultLocale)->get($data); |
@@ -206,7 +206,9 @@ |
||
| 206 | 206 | $repositoryAdapterName = $repositoryName.'Adapter'; |
| 207 | 207 | $repositoryNamespace = app()->namespace()->repository().'\\'.$repositoryName.'\\'.$repositoryAdapterName; |
| 208 | 208 | |
| 209 | - if($namespace) return $repositoryNamespace; |
|
| 209 | + if($namespace) {
|
|
| 210 | + return $repositoryNamespace; |
|
| 211 | + } |
|
| 210 | 212 | |
| 211 | 213 | //and eventually we conclude the adapter class of the repository package as an instance. |
| 212 | 214 | return app()->resolve($repositoryNamespace)->adapter(); |
@@ -42,13 +42,13 @@ discard block |
||
| 42 | 42 | * @param $urlRoute |
| 43 | 43 | * @return int|string |
| 44 | 44 | */ |
| 45 | - public static function checkArrayEqual($patterns,$urlRoute) |
|
| 45 | + public static function checkArrayEqual($patterns, $urlRoute) |
|
| 46 | 46 | {
|
| 47 | 47 | // calculates the equality difference between |
| 48 | 48 | // the route pattern and the urlRoute value. |
| 49 | - foreach ($patterns as $key=>$pattern){
|
|
| 49 | + foreach ($patterns as $key=>$pattern) {
|
|
| 50 | 50 | |
| 51 | - if(Utils::isArrayEqual($pattern,$urlRoute)){
|
|
| 51 | + if (Utils::isArrayEqual($pattern, $urlRoute)) {
|
|
| 52 | 52 | return $key; |
| 53 | 53 | } |
| 54 | 54 | } |
@@ -68,17 +68,17 @@ discard block |
||
| 68 | 68 | // get routes data and the resolving pattern |
| 69 | 69 | // Both are interrelated. |
| 70 | 70 | $routes = self::getRoutes(); |
| 71 | - $patternResolve = app()->resolve(RouteMatching::class,['route'=>new self()])->getPatternResolve(); |
|
| 71 | + $patternResolve = app()->resolve(RouteMatching::class, ['route'=>new self()])->getPatternResolve(); |
|
| 72 | 72 | |
| 73 | 73 | // |
| 74 | 74 | self::updateRouteParameters($patternResolve); |
| 75 | 75 | |
| 76 | 76 | //if routes data is available in pattern resolve. |
| 77 | - if(isset($routes['data'][$patternResolve])){
|
|
| 77 | + if (isset($routes['data'][$patternResolve])) {
|
|
| 78 | 78 | |
| 79 | 79 | // if the incoming http value is |
| 80 | 80 | // the same as the real request method, the data is processed. |
| 81 | - if($routes['data'][$patternResolve]['http'] == strtolower(httpMethod)){
|
|
| 81 | + if ($routes['data'][$patternResolve]['http']==strtolower(httpMethod)) {
|
|
| 82 | 82 | |
| 83 | 83 | // we are set the solved pattern to a variable. |
| 84 | 84 | $resolve = $routes['data'][$patternResolve]; |
@@ -104,24 +104,24 @@ discard block |
||
| 104 | 104 | {
|
| 105 | 105 | $list = []; |
| 106 | 106 | |
| 107 | - if(isset(static::$routes['pattern'][$patternResolvedKey])){
|
|
| 107 | + if (isset(static::$routes['pattern'][$patternResolvedKey])) {
|
|
| 108 | 108 | |
| 109 | 109 | $routeParameters = static::$routes['pattern'][$patternResolvedKey]; |
| 110 | 110 | $route = route(); |
| 111 | 111 | |
| 112 | - foreach($routeParameters as $key=>$param){
|
|
| 112 | + foreach ($routeParameters as $key=>$param) {
|
|
| 113 | 113 | |
| 114 | - $param = str_replace('{','',$param);
|
|
| 115 | - $param = str_replace('?','',$param);
|
|
| 116 | - $param = str_replace('}','',$param);
|
|
| 114 | + $param = str_replace('{', '', $param);
|
|
| 115 | + $param = str_replace('?', '', $param);
|
|
| 116 | + $param = str_replace('}', '', $param);
|
|
| 117 | 117 | |
| 118 | - if(isset($route[$key])){
|
|
| 118 | + if (isset($route[$key])) {
|
|
| 119 | 119 | $list[$param] = $route[$key]; |
| 120 | 120 | } |
| 121 | 121 | } |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | - app()->register('routeParams',$list);
|
|
| 124 | + app()->register('routeParams', $list);
|
|
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | /** |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | {
|
| 134 | 134 | // we will record the path data for the route. |
| 135 | 135 | // We set the routeMapper variables and the route path. |
| 136 | - self::setPath(function(){
|
|
| 136 | + self::setPath(function() {
|
|
| 137 | 137 | |
| 138 | 138 | // we are sending |
| 139 | 139 | // the controller and routes.php path. |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | |
| 146 | 146 | // in the paths data, |
| 147 | 147 | // we run the route mapper values and the route files one by one. |
| 148 | - foreach (self::$paths as $mapper=>$controller){
|
|
| 148 | + foreach (self::$paths as $mapper=>$controller) {
|
|
| 149 | 149 | core()->fileSystem->callFile($mapper); |
| 150 | 150 | } |
| 151 | 151 | } |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | {
|
| 160 | 160 | $routeDefinitor = call_user_func($callback); |
| 161 | 161 | |
| 162 | - if(isset($routeDefinitor['controllerPath']) && isset($routeDefinitor['routePath'])){
|
|
| 162 | + if (isset($routeDefinitor['controllerPath']) && isset($routeDefinitor['routePath'])) {
|
|
| 163 | 163 | |
| 164 | 164 | //the route paths to be saved to the mappers static property. |
| 165 | 165 | static::$mappers['routePaths'][] = $routeDefinitor['routePath']; |
@@ -167,22 +167,22 @@ discard block |
||
| 167 | 167 | |
| 168 | 168 | // if there is endpoint, |
| 169 | 169 | // then only that endpoint is transferred into the path |
| 170 | - if(defined('endpoint')){
|
|
| 170 | + if (defined('endpoint')) {
|
|
| 171 | 171 | |
| 172 | 172 | $routeName = endpoint.'Route.php'; |
| 173 | 173 | $routeMapper = $routeDefinitor['routePath'].''.DIRECTORY_SEPARATOR.''.$routeName; |
| 174 | 174 | |
| 175 | - if(file_exists($routeMapper) && !isset(static::$paths[$routeMapper])){
|
|
| 175 | + if (file_exists($routeMapper) && !isset(static::$paths[$routeMapper])) {
|
|
| 176 | 176 | static::$paths[$routeMapper] = $routeDefinitor['controllerPath']; |
| 177 | 177 | } |
| 178 | 178 | } |
| 179 | - else{
|
|
| 179 | + else {
|
|
| 180 | 180 | |
| 181 | 181 | // if there is no endpoint, |
| 182 | 182 | // all files in the path of the route are transferred to path. |
| 183 | 183 | $allFilesInThatRoutePath = Utils::glob($routeDefinitor['routePath']); |
| 184 | 184 | |
| 185 | - foreach ($allFilesInThatRoutePath as $item){
|
|
| 185 | + foreach ($allFilesInThatRoutePath as $item) {
|
|
| 186 | 186 | static::$paths[$item] = $routeDefinitor['controllerPath']; |
| 187 | 187 | } |
| 188 | 188 | } |
@@ -196,13 +196,13 @@ discard block |
||
| 196 | 196 | * @param $function |
| 197 | 197 | * @param null $controller |
| 198 | 198 | */ |
| 199 | - public static function setRoute($params,$function,$controller=null) |
|
| 199 | + public static function setRoute($params, $function, $controller = null) |
|
| 200 | 200 | {
|
| 201 | - [$pattern,$route] = $params; |
|
| 202 | - [$class,$method] = explode("@",$route);
|
|
| 201 | + [$pattern, $route] = $params; |
|
| 202 | + [$class, $method] = explode("@", $route);
|
|
| 203 | 203 | |
| 204 | 204 | $patternList = array_values( |
| 205 | - array_filter(explode("/",$pattern),'strlen')
|
|
| 205 | + array_filter(explode("/", $pattern), 'strlen')
|
|
| 206 | 206 | ); |
| 207 | 207 | |
| 208 | 208 | static::$routes['pattern'][] = $patternList; |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | 'http' => $function, |
| 213 | 213 | 'controller' => $controller, |
| 214 | 214 | 'namespace' => static::$namespace, |
| 215 | - 'endpoint' => strtolower(str_replace(StaticPathList::$controllerBundleName,'',static::$namespace)) |
|
| 215 | + 'endpoint' => strtolower(str_replace(StaticPathList::$controllerBundleName, '', static::$namespace)) |
|
| 216 | 216 | ]; |
| 217 | 217 | } |
| 218 | 218 | |
@@ -222,11 +222,11 @@ discard block |
||
| 222 | 222 | * @param null $value |
| 223 | 223 | * @return bool |
| 224 | 224 | */ |
| 225 | - public static function isMatchVaribleRegexPattern($value=null) |
|
| 225 | + public static function isMatchVaribleRegexPattern($value = null) |
|
| 226 | 226 | {
|
| 227 | 227 | // determines if the variable that can be used |
| 228 | 228 | // in the route file meets the regex rule. |
| 229 | - return (preg_match('@\{(.*?)\}@is',$value)) ? true : false;
|
|
| 229 | + return (preg_match('@\{(.*?)\}@is', $value)) ? true : false;
|
|
| 230 | 230 | } |
| 231 | 231 | |
| 232 | 232 | |
@@ -236,11 +236,11 @@ discard block |
||
| 236 | 236 | * @param null $value |
| 237 | 237 | * @return bool |
| 238 | 238 | */ |
| 239 | - public static function isOptionalVaribleRegexPattern($value=null) |
|
| 239 | + public static function isOptionalVaribleRegexPattern($value = null) |
|
| 240 | 240 | {
|
| 241 | 241 | // determines if the variable that can be used |
| 242 | 242 | // in the route file meets the regex rule. |
| 243 | - return preg_match('@\{[a-z]+\?\}@is',$value) ? true : false;
|
|
| 243 | + return preg_match('@\{[a-z]+\?\}@is', $value) ? true : false;
|
|
| 244 | 244 | } |
| 245 | 245 | |
| 246 | 246 | |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | */ |
| 50 | 50 | function applicationKey() |
| 51 | 51 | {
|
| 52 | - if(property_exists($kernel=app()->kernel(),'applicationKey')){
|
|
| 52 | + if (property_exists($kernel = app()->kernel(), 'applicationKey')) {
|
|
| 53 | 53 | return $kernel->applicationKey; |
| 54 | 54 | } |
| 55 | 55 | return null; |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | */ |
| 83 | 83 | function bundleName() |
| 84 | 84 | {
|
| 85 | - if(defined('endpoint')){
|
|
| 85 | + if (defined('endpoint')) {
|
|
| 86 | 86 | |
| 87 | 87 | return endpoint.''.StaticPathList::$controllerBundleName; |
| 88 | 88 | } |
@@ -97,11 +97,11 @@ discard block |
||
| 97 | 97 | * @param null $default |
| 98 | 98 | * @return mixed|null |
| 99 | 99 | */ |
| 100 | - function config($config=null,$default=null) |
|
| 100 | + function config($config = null, $default = null) |
|
| 101 | 101 | {
|
| 102 | 102 | $configResult = app()->config($config); |
| 103 | 103 | |
| 104 | - if($configResult === null && $default!==null){
|
|
| 104 | + if ($configResult===null && $default!==null) {
|
|
| 105 | 105 | return $default; |
| 106 | 106 | } |
| 107 | 107 | |
@@ -116,9 +116,9 @@ discard block |
||
| 116 | 116 | * @param $bind array |
| 117 | 117 | * @return mixed |
| 118 | 118 | */ |
| 119 | - function container($class,$bind=array()) |
|
| 119 | + function container($class, $bind = array()) |
|
| 120 | 120 | {
|
| 121 | - return app()->singleton()->appClass->container(appInstance(),$class,$bind); |
|
| 121 | + return app()->singleton()->appClass->container(appInstance(), $class, $bind); |
|
| 122 | 122 | } |
| 123 | 123 | } |
| 124 | 124 | |
@@ -178,10 +178,10 @@ discard block |
||
| 178 | 178 | * @param array $params |
| 179 | 179 | * @return ExceptionContracts |
| 180 | 180 | */ |
| 181 | - function exception($name=null,$params=array()) |
|
| 181 | + function exception($name = null, $params = array()) |
|
| 182 | 182 | {
|
| 183 | - $exceptionManager=ExceptionManager::class; |
|
| 184 | - return app()->resolve($exceptionManager,['name'=>$name,'params'=>$params]); |
|
| 183 | + $exceptionManager = ExceptionManager::class; |
|
| 184 | + return app()->resolve($exceptionManager, ['name'=>$name, 'params'=>$params]); |
|
| 185 | 185 | } |
| 186 | 186 | } |
| 187 | 187 | |
@@ -191,13 +191,13 @@ discard block |
||
| 191 | 191 | * @param null $locale |
| 192 | 192 | * @return Generator |
| 193 | 193 | */ |
| 194 | - function faker($locale=null) |
|
| 194 | + function faker($locale = null) |
|
| 195 | 195 | {
|
| 196 | - if($locale===null){
|
|
| 197 | - $faker=Factory::create(); |
|
| 196 | + if ($locale===null) {
|
|
| 197 | + $faker = Factory::create(); |
|
| 198 | 198 | } |
| 199 | - else{
|
|
| 200 | - $faker=Factory::create($locale); |
|
| 199 | + else {
|
|
| 200 | + $faker = Factory::create($locale); |
|
| 201 | 201 | } |
| 202 | 202 | |
| 203 | 203 | return $faker; |
@@ -208,8 +208,8 @@ discard block |
||
| 208 | 208 | |
| 209 | 209 | function fingerPrint() |
| 210 | 210 | {
|
| 211 | - return md5(sha1(implode("|",[
|
|
| 212 | - request()->getClientIp(),$_SERVER['HTTP_USER_AGENT'],applicationKey() |
|
| 211 | + return md5(sha1(implode("|", [
|
|
| 212 | + request()->getClientIp(), $_SERVER['HTTP_USER_AGENT'], applicationKey() |
|
| 213 | 213 | ]))); |
| 214 | 214 | } |
| 215 | 215 | } |
@@ -229,10 +229,10 @@ discard block |
||
| 229 | 229 | * @param null $default |
| 230 | 230 | * @return null |
| 231 | 231 | */ |
| 232 | - function get($param=null,$default=null) |
|
| 232 | + function get($param = null, $default = null) |
|
| 233 | 233 | {
|
| 234 | 234 | //symfony request query object |
| 235 | - $get=core()->get; |
|
| 235 | + $get = core()->get; |
|
| 236 | 236 | |
| 237 | 237 | return ($param===null) ? $get : (isset($get[$param]) ? $get[$param] : $default); |
| 238 | 238 | } |
@@ -245,14 +245,14 @@ discard block |
||
| 245 | 245 | * @param null $default |
| 246 | 246 | * @return array |
| 247 | 247 | */ |
| 248 | - function headers($param=null,$default=null) |
|
| 248 | + function headers($param = null, $default = null) |
|
| 249 | 249 | {
|
| 250 | - $list=[]; |
|
| 250 | + $list = []; |
|
| 251 | 251 | |
| 252 | 252 | //We only get the objects in the list name to match the header objects |
| 253 | 253 | //that come with the request path to the objects sent by the client |
| 254 | 254 | foreach (request()->headers->all() as $key=>$value) {
|
| 255 | - $list[$key]=$value; |
|
| 255 | + $list[$key] = $value; |
|
| 256 | 256 | } |
| 257 | 257 | |
| 258 | 258 | //return header list |
@@ -277,9 +277,9 @@ discard block |
||
| 277 | 277 | * @param $file null |
| 278 | 278 | * @return LoggerHandler |
| 279 | 279 | */ |
| 280 | - function logger($file=null) |
|
| 280 | + function logger($file = null) |
|
| 281 | 281 | {
|
| 282 | - return app()->resolve(LoggerHandler::class,['file'=>$file]); |
|
| 282 | + return app()->resolve(LoggerHandler::class, ['file'=>$file]); |
|
| 283 | 283 | } |
| 284 | 284 | } |
| 285 | 285 | |
@@ -301,7 +301,7 @@ discard block |
||
| 301 | 301 | */ |
| 302 | 302 | function response() |
| 303 | 303 | {
|
| 304 | - $object=debug_backtrace()[1]['object']; |
|
| 304 | + $object = debug_backtrace()[1]['object']; |
|
| 305 | 305 | return new ResponseOutManager($object); |
| 306 | 306 | } |
| 307 | 307 | } |
@@ -316,9 +316,9 @@ discard block |
||
| 316 | 316 | * @throws \DI\DependencyException |
| 317 | 317 | * @throws \DI\NotFoundException |
| 318 | 318 | */ |
| 319 | - function resolve($class,$bind=array()) |
|
| 319 | + function resolve($class, $bind = array()) |
|
| 320 | 320 | {
|
| 321 | - return app()->resolve($class,$bind); |
|
| 321 | + return app()->resolve($class, $bind); |
|
| 322 | 322 | } |
| 323 | 323 | } |
| 324 | 324 | |
@@ -328,10 +328,10 @@ discard block |
||
| 328 | 328 | * @param $key |
| 329 | 329 | * @return mixed |
| 330 | 330 | */ |
| 331 | - function route($key=null) |
|
| 331 | + function route($key = null) |
|
| 332 | 332 | {
|
| 333 | - if(is_null($key)){
|
|
| 334 | - return array_map(function($route){
|
|
| 333 | + if (is_null($key)) {
|
|
| 334 | + return array_map(function($route) {
|
|
| 335 | 335 | return strtolower($route); |
| 336 | 336 | },app()->singleton()->appClass->route($key)); |
| 337 | 337 | } |
@@ -359,10 +359,10 @@ discard block |
||
| 359 | 359 | * @param null $default |
| 360 | 360 | * @return mixed |
| 361 | 361 | */ |
| 362 | - function post($param=null,$default=null) |
|
| 362 | + function post($param = null, $default = null) |
|
| 363 | 363 | {
|
| 364 | 364 | //symfony request query object |
| 365 | - $post=core()->post; |
|
| 365 | + $post = core()->post; |
|
| 366 | 366 | |
| 367 | 367 | return ($param===null) ? $post : (isset($post[$param]) ? $post[$param] : $default); |
| 368 | 368 | } |
@@ -393,8 +393,8 @@ discard block |
||
| 393 | 393 | * @param array $select |
| 394 | 394 | * @return mixed |
| 395 | 395 | */ |
| 396 | - function trans($lang,$select=array()) |
|
| 396 | + function trans($lang, $select = array()) |
|
| 397 | 397 | {
|
| 398 | - return app()->singleton()->appClass->translator($lang,$select); |
|
| 398 | + return app()->singleton()->appClass->translator($lang, $select); |
|
| 399 | 399 | } |
| 400 | 400 | } |
| 401 | 401 | \ No newline at end of file |