@@ -35,21 +35,21 @@ |
||
35 | 35 | * @param $bind |
36 | 36 | * @return mixed|string |
37 | 37 | */ |
38 | - public function controller($endpoint=null,$bind=array()) |
|
38 | + public function controller($endpoint = null, $bind = array()) |
|
39 | 39 | { |
40 | - $call=Utils::getNamespace($this->appCall()); |
|
40 | + $call = Utils::getNamespace($this->appCall()); |
|
41 | 41 | |
42 | - if($endpoint===null) return $call; |
|
42 | + if ($endpoint===null) return $call; |
|
43 | 43 | |
44 | 44 | $bundleName = $call.'\\'.ucfirst($endpoint).''.StaticPathList::$controllerBundleName.''; |
45 | 45 | |
46 | - $endpointCall=$bundleName.'\\'.ucfirst($endpoint).''.StaticPathModel::$callClassPrefix; |
|
46 | + $endpointCall = $bundleName.'\\'.ucfirst($endpoint).''.StaticPathModel::$callClassPrefix; |
|
47 | 47 | |
48 | - if($bind===true) return $endpointCall; |
|
48 | + if ($bind===true) return $endpointCall; |
|
49 | 49 | |
50 | - if($bind=="bundle") return $bundleName; |
|
50 | + if ($bind=="bundle") return $bundleName; |
|
51 | 51 | |
52 | - return app()->resolve($endpointCall,$bind); |
|
52 | + return app()->resolve($endpointCall, $bind); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | /** |
@@ -39,15 +39,21 @@ |
||
39 | 39 | { |
40 | 40 | $call=Utils::getNamespace($this->appCall()); |
41 | 41 | |
42 | - if($endpoint===null) return $call; |
|
42 | + if($endpoint===null) { |
|
43 | + return $call; |
|
44 | + } |
|
43 | 45 | |
44 | 46 | $bundleName = $call.'\\'.ucfirst($endpoint).''.StaticPathList::$controllerBundleName.''; |
45 | 47 | |
46 | 48 | $endpointCall=$bundleName.'\\'.ucfirst($endpoint).''.StaticPathModel::$callClassPrefix; |
47 | 49 | |
48 | - if($bind===true) return $endpointCall; |
|
50 | + if($bind===true) { |
|
51 | + return $endpointCall; |
|
52 | + } |
|
49 | 53 | |
50 | - if($bind=="bundle") return $bundleName; |
|
54 | + if($bind=="bundle") { |
|
55 | + return $bundleName; |
|
56 | + } |
|
51 | 57 | |
52 | 58 | return app()->resolve($endpointCall,$bind); |
53 | 59 | } |
@@ -11,14 +11,14 @@ discard block |
||
11 | 11 | * @param null $group |
12 | 12 | * @return mixed|string |
13 | 13 | */ |
14 | - public static function projectPrefix($group=null) |
|
14 | + public static function projectPrefix($group = null) |
|
15 | 15 | { |
16 | - if($group!==null){ |
|
16 | + if ($group!==null) { |
|
17 | 17 | return self::$projectPrefix.''.DIRECTORY_SEPARATOR.''.$group; |
18 | 18 | } |
19 | 19 | |
20 | - if(defined('group')){ |
|
21 | - return str_replace("\\","/",group); |
|
20 | + if (defined('group')) { |
|
21 | + return str_replace("\\", "/", group); |
|
22 | 22 | } |
23 | 23 | } |
24 | 24 | |
@@ -27,9 +27,9 @@ discard block |
||
27 | 27 | * @param $path |
28 | 28 | * @return mixed |
29 | 29 | */ |
30 | - public static function projectPath($prefix,$path) |
|
30 | + public static function projectPath($prefix, $path) |
|
31 | 31 | { |
32 | - return str_replace($prefix.'',"",$path); |
|
32 | + return str_replace($prefix.'', "", $path); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | /** |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | public static function appPath() |
59 | 59 | { |
60 | 60 | //get app path for application |
61 | - return self::$appPath=root.''.DIRECTORY_SEPARATOR.''.self::$appDefine.'/app'; |
|
61 | + return self::$appPath = root.''.DIRECTORY_SEPARATOR.''.self::$appDefine.'/app'; |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | /** |
@@ -75,10 +75,10 @@ discard block |
||
75 | 75 | */ |
76 | 76 | public static function getAppStorage() |
77 | 77 | { |
78 | - if(!defined('app')) define('app',null); |
|
78 | + if (!defined('app')) define('app', null); |
|
79 | 79 | |
80 | 80 | //get app path for application |
81 | - return self::projectPath(self::projectPrefix(),self::appPath().''.DIRECTORY_SEPARATOR.''.self::slashToBackSlash(app).''.self::$storage); |
|
81 | + return self::projectPath(self::projectPrefix(), self::appPath().''.DIRECTORY_SEPARATOR.''.self::slashToBackSlash(app).''.self::$storage); |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | /** |
@@ -95,13 +95,13 @@ discard block |
||
95 | 95 | */ |
96 | 96 | public static function getEnvironmentFile() |
97 | 97 | { |
98 | - if(defined('app')){ |
|
98 | + if (defined('app')) { |
|
99 | 99 | |
100 | - $appProject=explode("\\",app); |
|
101 | - $app=str_replace("\\","",app); |
|
102 | - $environmentFile=self::appPath().''.DIRECTORY_SEPARATOR.''.strtolower($app).'.yaml'; |
|
100 | + $appProject = explode("\\", app); |
|
101 | + $app = str_replace("\\", "", app); |
|
102 | + $environmentFile = self::appPath().''.DIRECTORY_SEPARATOR.''.strtolower($app).'.yaml'; |
|
103 | 103 | |
104 | - if(file_exists($environmentFile)){ |
|
104 | + if (file_exists($environmentFile)) { |
|
105 | 105 | //get app path for application |
106 | 106 | return $environmentFile; |
107 | 107 | } |
@@ -116,11 +116,11 @@ discard block |
||
116 | 116 | * @param bool $path |
117 | 117 | * @return string |
118 | 118 | */ |
119 | - public static function appVersionRoot($app=null,$path=false) |
|
119 | + public static function appVersionRoot($app = null, $path = false) |
|
120 | 120 | { |
121 | - $app=($app!==null) ? $app : (defined('app')) ? app : null; |
|
121 | + $app = ($app!==null) ? $app : (defined('app')) ? app : null; |
|
122 | 122 | |
123 | - if($path){ |
|
123 | + if ($path) { |
|
124 | 124 | |
125 | 125 | return self::appPath().''.DIRECTORY_SEPARATOR.''.self::slashToBackSlash($app).''.DIRECTORY_SEPARATOR.''.UrlVersionIdentifier::version().''; |
126 | 126 | } |
@@ -140,8 +140,8 @@ discard block |
||
140 | 140 | */ |
141 | 141 | public static function getServiceConf() |
142 | 142 | { |
143 | - if(defined('endpoint')){ |
|
144 | - return path()->controller(endpoint,true).''.DIRECTORY_SEPARATOR.''.StaticPathModel::$configurationInController.'/ServiceConf.php'; |
|
143 | + if (defined('endpoint')) { |
|
144 | + return path()->controller(endpoint, true).''.DIRECTORY_SEPARATOR.''.StaticPathModel::$configurationInController.'/ServiceConf.php'; |
|
145 | 145 | } |
146 | 146 | return []; |
147 | 147 | } |
@@ -158,10 +158,10 @@ discard block |
||
158 | 158 | * @param bool $namespace |
159 | 159 | * @return string |
160 | 160 | */ |
161 | - public static function appConfig($namespace=false) |
|
161 | + public static function appConfig($namespace = false) |
|
162 | 162 | { |
163 | 163 | //get app config path for application |
164 | - if(false===$namespace){ |
|
164 | + if (false===$namespace) { |
|
165 | 165 | return self::appPath().''.DIRECTORY_SEPARATOR.''.self::slashToBackSlash(app).''.DIRECTORY_SEPARATOR.''.UrlVersionIdentifier::version().''.DIRECTORY_SEPARATOR.''.self::$config; |
166 | 166 | } |
167 | 167 | return self::$autoloadNamespace.'\\'.app.'\\'.UrlVersionIdentifier::version().'\\'.self::$config; |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | { |
175 | 175 | //get http header |
176 | 176 | /*** @var $httpHeaders \Store\Config\HttpHeaders */ |
177 | - $httpHeaders=self::$store.'\Config\HttpHeaders'; |
|
177 | + $httpHeaders = self::$store.'\Config\HttpHeaders'; |
|
178 | 178 | |
179 | 179 | //return http headers |
180 | 180 | return $httpHeaders::$httpHeaders; |
@@ -193,10 +193,10 @@ discard block |
||
193 | 193 | * @param bool $path |
194 | 194 | * @return string |
195 | 195 | */ |
196 | - public static function appAnnotation($app=null,$path=false) |
|
196 | + public static function appAnnotation($app = null, $path = false) |
|
197 | 197 | { |
198 | - if($path){ |
|
199 | - return self::appVersionRoot($app,true).'/ServiceAnnotationsManager.php'; |
|
198 | + if ($path) { |
|
199 | + return self::appVersionRoot($app, true).'/ServiceAnnotationsManager.php'; |
|
200 | 200 | } |
201 | 201 | return self::appVersionRoot($app).'\\ServiceAnnotationsManager'; |
202 | 202 | } |
@@ -213,11 +213,11 @@ discard block |
||
213 | 213 | * @param null $app |
214 | 214 | * @return string |
215 | 215 | */ |
216 | - public static function appMiddlewarePath($app=null) |
|
216 | + public static function appMiddlewarePath($app = null) |
|
217 | 217 | { |
218 | - if($app!==null){ |
|
219 | - if(!defined('app')){ |
|
220 | - define('app',$app); |
|
218 | + if ($app!==null) { |
|
219 | + if (!defined('app')) { |
|
220 | + define('app', $app); |
|
221 | 221 | } |
222 | 222 | } |
223 | 223 | return self::$autoloadNamespace.'\\'.app.'\\'.UrlVersionIdentifier::version().'\\'.self::$middleware; |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | * @param null $app |
228 | 228 | * @return string |
229 | 229 | */ |
230 | - public static function appSourceEndpoint($app=null) |
|
230 | + public static function appSourceEndpoint($app = null) |
|
231 | 231 | { |
232 | 232 | return self::appVersionRoot($app).'\\'.self::$optional.'\\'.self::$sourcePath.'\Endpoint'; |
233 | 233 | } |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | * @param null $app |
237 | 237 | * @return string |
238 | 238 | */ |
239 | - public static function appBuilder($app=null) |
|
239 | + public static function appBuilder($app = null) |
|
240 | 240 | { |
241 | 241 | return self::appVersionRoot($app).'\\'.self::$model.'\\'.self::$builder; |
242 | 242 | } |
@@ -279,6 +279,6 @@ discard block |
||
279 | 279 | */ |
280 | 280 | private static function slashToBackSlash($data) |
281 | 281 | { |
282 | - return str_replace("\\","/",$data); |
|
282 | + return str_replace("\\", "/", $data); |
|
283 | 283 | } |
284 | 284 | } |
285 | 285 | \ No newline at end of file |
@@ -75,7 +75,9 @@ |
||
75 | 75 | */ |
76 | 76 | public static function getAppStorage() |
77 | 77 | { |
78 | - if(!defined('app')) define('app',null); |
|
78 | + if(!defined('app')) { |
|
79 | + define('app',null); |
|
80 | + } |
|
79 | 81 | |
80 | 82 | //get app path for application |
81 | 83 | return self::projectPath(self::projectPrefix(),self::appPath().''.DIRECTORY_SEPARATOR.''.self::slashToBackSlash(app).''.self::$storage); |
@@ -183,8 +183,7 @@ |
||
183 | 183 | { |
184 | 184 | if($locale===null){ |
185 | 185 | $faker=Factory::create(); |
186 | - } |
|
187 | - else{ |
|
186 | + } else{ |
|
188 | 187 | $faker=Factory::create($locale); |
189 | 188 | } |
190 | 189 |
@@ -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 | |
@@ -432,9 +432,9 @@ discard block |
||
432 | 432 | * @param null|string $table |
433 | 433 | * @return void|array |
434 | 434 | */ |
435 | - function entities($table=null) |
|
435 | + function entities($table = null) |
|
436 | 436 | { |
437 | - if(!is_null($table) && app()->has('entities')){ |
|
437 | + if (!is_null($table) && app()->has('entities')) { |
|
438 | 438 | return app()->get('entities')($table); |
439 | 439 | } |
440 | 440 | |
@@ -451,7 +451,7 @@ discard block |
||
451 | 451 | { |
452 | 452 | $file = app()->path()->kernel().''.DIRECTORY_SEPARATOR.'service.json'; |
453 | 453 | |
454 | - if(file_exists($file)){ |
|
454 | + if (file_exists($file)) { |
|
455 | 455 | return $file; |
456 | 456 | } |
457 | 457 |
@@ -18,12 +18,12 @@ discard block |
||
18 | 18 | // We get instance for customBooter class |
19 | 19 | // we get our object-protected boot lists |
20 | 20 | // directly in the application class with the help of public access method. |
21 | - $customBooter = $app->resolve(CustomBooter::class,['boot'=>end($booter)]); |
|
21 | + $customBooter = $app->resolve(CustomBooter::class, ['boot'=>end($booter)]); |
|
22 | 22 | $boot = ($customBooter)->customBootstrappers($booter); |
23 | 23 | |
24 | 24 | // and as a result we now use |
25 | 25 | //the instance properties of our boot lists to include our implementation. |
26 | - $app->resolve(FinalBooting::class,['boot'=>$boot]); |
|
26 | + $app->resolve(FinalBooting::class, ['boot'=>$boot]); |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | /** |
@@ -31,11 +31,11 @@ discard block |
||
31 | 31 | * @param callable $callback |
32 | 32 | * @return mixed |
33 | 33 | */ |
34 | - public static function setBootFire($kernel=array(),callable $callback) |
|
34 | + public static function setBootFire($kernel = array(), callable $callback) |
|
35 | 35 | { |
36 | 36 | //The boot method to be executed can be specified by the user. |
37 | 37 | //We use this method to know how to customize it. |
38 | - return call_user_func_array($callback,[self::setParametersForKernelCallback($kernel)]); |
|
38 | + return call_user_func_array($callback, [self::setParametersForKernelCallback($kernel)]); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | /** |
@@ -34,8 +34,7 @@ |
||
34 | 34 | // if not available, only the core is executed. |
35 | 35 | if(file_exists(app()->path()->storeDir())){ |
36 | 36 | $this->app->register('isAvailableStore',true); |
37 | - } |
|
38 | - else{ |
|
37 | + } else{ |
|
39 | 38 | $this->app->register('isAvailableStore',false); |
40 | 39 | } |
41 | 40 | } |
@@ -139,12 +139,12 @@ |
||
139 | 139 | if(Utils::isNamespaceExists($requestService)){ |
140 | 140 | |
141 | 141 | Request::setFactory(function(array $query = array(), |
142 | - array $request = array(), |
|
143 | - array $attributes = array(), |
|
144 | - array $cookies = array(), |
|
145 | - array $files = array(), |
|
146 | - array $server = array(), |
|
147 | - $content = null) use ($requestService) |
|
142 | + array $request = array(), |
|
143 | + array $attributes = array(), |
|
144 | + array $cookies = array(), |
|
145 | + array $files = array(), |
|
146 | + array $server = array(), |
|
147 | + $content = null) use ($requestService) |
|
148 | 148 | { |
149 | 149 | return new $requestService($query, |
150 | 150 | $request, |
@@ -30,11 +30,11 @@ discard block |
||
30 | 30 | // if the store directory is available, |
31 | 31 | // then the application process continues. |
32 | 32 | // if not available, only the core is executed. |
33 | - if(file_exists(app()->path()->storeDir())){ |
|
34 | - $this->app->register('isAvailableStore',true); |
|
33 | + if (file_exists(app()->path()->storeDir())) { |
|
34 | + $this->app->register('isAvailableStore', true); |
|
35 | 35 | } |
36 | - else{ |
|
37 | - $this->app->register('isAvailableStore',false); |
|
36 | + else { |
|
37 | + $this->app->register('isAvailableStore', false); |
|
38 | 38 | } |
39 | 39 | } |
40 | 40 | |
@@ -48,13 +48,13 @@ discard block |
||
48 | 48 | { |
49 | 49 | //we can use this method to move an instance of the application class with the kernel object |
50 | 50 | //and easily resolve an encrypted instance of all the kernel variables in our helper class. |
51 | - ClassAliasGroup::setAlias(App::class,'application'); |
|
51 | + ClassAliasGroup::setAlias(App::class, 'application'); |
|
52 | 52 | |
53 | 53 | //set base instances |
54 | 54 | $this->setBaseInstances(); |
55 | 55 | |
56 | 56 | //we define the general application instance object. |
57 | - define('appInstance',(base64_encode(serialize($this->app)))); |
|
57 | + define('appInstance', (base64_encode(serialize($this->app)))); |
|
58 | 58 | |
59 | 59 | //main loader for application |
60 | 60 | $this->mainLoader(); |
@@ -69,8 +69,8 @@ discard block |
||
69 | 69 | // this function can be used for defining your own way of handling errors during runtime, |
70 | 70 | // for example in applications in which you need to do cleanup of data/files when a critical error happens, |
71 | 71 | // or when you need to trigger an error under certain conditions (using trigger_error()). |
72 | - if($this->app['isAvailableStore']){ |
|
73 | - $this->app->make('exception',function(){ |
|
72 | + if ($this->app['isAvailableStore']) { |
|
73 | + $this->app->make('exception', function() { |
|
74 | 74 | return ErrorProvider::class; |
75 | 75 | }); |
76 | 76 | } |
@@ -85,33 +85,33 @@ discard block |
||
85 | 85 | { |
86 | 86 | // for revision records, |
87 | 87 | // the master key is assigned as revision. |
88 | - $this->app->register('revision',[]); |
|
88 | + $this->app->register('revision', []); |
|
89 | 89 | |
90 | 90 | //we're saving the directory where kernel files are running to the kernel object. |
91 | - $this->app->register('corePath',str_replace('Foundation','',__DIR__.'')); |
|
91 | + $this->app->register('corePath', str_replace('Foundation', '', __DIR__.'')); |
|
92 | 92 | |
93 | 93 | //For the application, we create the object that the register method, |
94 | 94 | // which is the container center, is connected to by the kernel object register method. |
95 | - $this->app->register('container',$this->app); |
|
95 | + $this->app->register('container', $this->app); |
|
96 | 96 | |
97 | 97 | // We are saving the application class to |
98 | 98 | // the container object for the appClass value. |
99 | - $this->app->register('appClass',new App()); |
|
99 | + $this->app->register('appClass', new App()); |
|
100 | 100 | |
101 | 101 | //set closure bind instance for application |
102 | - $this->app->register('appClosureInstance',ClosureDispatcher::bind(app())); |
|
102 | + $this->app->register('appClosureInstance', ClosureDispatcher::bind(app())); |
|
103 | 103 | |
104 | 104 | //set closure bind instance for bootLoader class |
105 | - $this->app->register('closureBootLoader',ClosureDispatcher::bind($this->app['bootLoader'])); |
|
105 | + $this->app->register('closureBootLoader', ClosureDispatcher::bind($this->app['bootLoader'])); |
|
106 | 106 | |
107 | 107 | //set register for macro |
108 | - $this->app->register('macro',$this->app->resolve(Macro::class)); |
|
108 | + $this->app->register('macro', $this->app->resolve(Macro::class)); |
|
109 | 109 | |
110 | 110 | //set register for macro |
111 | - $this->app->register('pipeline',new Pipeline()); |
|
111 | + $this->app->register('pipeline', new Pipeline()); |
|
112 | 112 | |
113 | - $this->app->register('di',function($instance,$method){ |
|
114 | - return DIContainerManager::callBind([$instance,$method],$this->app->applicationProviderBinding($this->app)); |
|
113 | + $this->app->register('di', function($instance, $method) { |
|
114 | + return DIContainerManager::callBind([$instance, $method], $this->app->applicationProviderBinding($this->app)); |
|
115 | 115 | }); |
116 | 116 | |
117 | 117 | } |
@@ -126,10 +126,10 @@ discard block |
||
126 | 126 | //register as instance application object |
127 | 127 | // and container instance resolve |
128 | 128 | //set core instance value |
129 | - $this->app->instance('container',$this->app->singleton()); |
|
130 | - $this->app->instance('bootLoader',$this->app->resolve(BootLoader::class)); |
|
131 | - $this->app->instance('containerInstanceResolve',ContainerInstanceResolver::class); |
|
132 | - $this->app->instance('reflection',ReflectionProcess::class); |
|
129 | + $this->app->instance('container', $this->app->singleton()); |
|
130 | + $this->app->instance('bootLoader', $this->app->resolve(BootLoader::class)); |
|
131 | + $this->app->instance('containerInstanceResolve', ContainerInstanceResolver::class); |
|
132 | + $this->app->instance('reflection', ReflectionProcess::class); |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | /** |
@@ -138,19 +138,19 @@ discard block |
||
138 | 138 | private function setGlobalAccessor() |
139 | 139 | { |
140 | 140 | //get response success and status |
141 | - $this->app->register('instanceController',null); |
|
142 | - $this->app->register('responseSuccess',true); |
|
143 | - $this->app->register('responseStatus',200); |
|
144 | - $this->app->register('responseType','json'); |
|
141 | + $this->app->register('instanceController', null); |
|
142 | + $this->app->register('responseSuccess', true); |
|
143 | + $this->app->register('responseStatus', 200); |
|
144 | + $this->app->register('responseType', 'json'); |
|
145 | 145 | |
146 | 146 | //we first load the response class as a singleton object to allow you to send output anywhere |
147 | - $this->app->register('out',$this->app->resolve(ResponseProvider::class)); |
|
147 | + $this->app->register('out', $this->app->resolve(ResponseProvider::class)); |
|
148 | 148 | |
149 | 149 | $requestService = "Store\Services\RequestService"; |
150 | 150 | |
151 | 151 | //The HttpFoundation component defines an object-oriented layer for the HTTP specification. |
152 | 152 | //The HttpFoundation component replaces these default PHP global variables and functions by an object-oriented layer |
153 | - if(Utils::isNamespaceExists($requestService)){ |
|
153 | + if (Utils::isNamespaceExists($requestService)) { |
|
154 | 154 | |
155 | 155 | Request::setFactory(function(array $query = array(), |
156 | 156 | array $request = array(), |
@@ -172,16 +172,16 @@ discard block |
||
172 | 172 | |
173 | 173 | |
174 | 174 | //After registering the symfony request method, we also save the get and post methods for user convenience. |
175 | - $this->app->register('request',Request::createFromGlobals()); |
|
176 | - $this->app->register('get',core()->request->query->all()); |
|
177 | - $this->app->register('post',core()->request->request->all()); |
|
175 | + $this->app->register('request', Request::createFromGlobals()); |
|
176 | + $this->app->register('get', core()->request->query->all()); |
|
177 | + $this->app->register('post', core()->request->request->all()); |
|
178 | 178 | |
179 | 179 | //We determine with the kernel object which HTTP method the requested from the client |
180 | - $this->app->register('httpMethod',ucfirst(strtolower(core()->request->getRealMethod()))); |
|
180 | + $this->app->register('httpMethod', ucfirst(strtolower(core()->request->getRealMethod()))); |
|
181 | 181 | |
182 | - define('httpMethod',strtoupper(core()->httpMethod)); |
|
182 | + define('httpMethod', strtoupper(core()->httpMethod)); |
|
183 | 183 | |
184 | - $this->app->register('fileSystem',new FileProcess()); |
|
184 | + $this->app->register('fileSystem', new FileProcess()); |
|
185 | 185 | } |
186 | 186 | |
187 | 187 | } |
188 | 188 | \ No newline at end of file |
@@ -117,8 +117,7 @@ |
||
117 | 117 | //the value corresponding to the bind value for the global object is assigned and |
118 | 118 | //the resolve method is called for the dependency method. |
119 | 119 | $this->app->register('serviceContainer',$object,$concrete); |
120 | - } |
|
121 | - else{ |
|
120 | + } else{ |
|
122 | 121 | |
123 | 122 | // the service container objects are saved only once. |
124 | 123 | // Overflow exception is thrown on multiple records. |
@@ -12,12 +12,12 @@ discard block |
||
12 | 12 | * @param $callback |
13 | 13 | * @return void |
14 | 14 | */ |
15 | - public function consoleShared($object,$callback) |
|
15 | + public function consoleShared($object, $callback) |
|
16 | 16 | { |
17 | 17 | //The console share is evaluated as a true variable to be assigned as the 3rd parameter in the classes to be bound. |
18 | 18 | //The work to be done here is to bind the classes to be included in the console share privately. |
19 | - if($this->app->console()){ |
|
20 | - $this->app->register('consoleShared',$object,$this->getConcrete($callback)); |
|
19 | + if ($this->app->console()) { |
|
20 | + $this->app->register('consoleShared', $object, $this->getConcrete($callback)); |
|
21 | 21 | } |
22 | 22 | } |
23 | 23 | |
@@ -27,8 +27,8 @@ discard block |
||
27 | 27 | public function container() |
28 | 28 | { |
29 | 29 | //We are initializing the array property for the service container object. |
30 | - if(!isset($this->app['serviceContainer'])){ |
|
31 | - $this->app->register('serviceContainer',[]); |
|
30 | + if (!isset($this->app['serviceContainer'])) { |
|
31 | + $this->app->register('serviceContainer', []); |
|
32 | 32 | } |
33 | 33 | } |
34 | 34 | |
@@ -48,22 +48,22 @@ discard block |
||
48 | 48 | * @param $concrete |
49 | 49 | * @return void |
50 | 50 | */ |
51 | - private function setKernel($object,$concrete) |
|
51 | + private function setKernel($object, $concrete) |
|
52 | 52 | { |
53 | 53 | //We check that the concrete object |
54 | 54 | //is an object that can be retrieved. |
55 | - if(!isset($this->app[$object]) && class_exists($concrete)){ |
|
55 | + if (!isset($this->app[$object]) && class_exists($concrete)) { |
|
56 | 56 | |
57 | 57 | //get concrete instance |
58 | 58 | $concreteInstance = $this->app->resolve($concrete); |
59 | 59 | |
60 | 60 | //the value corresponding to the bind value for the global object is assigned and |
61 | 61 | //the resolve method is called for the dependency injection. |
62 | - $this->app->register($object,$concreteInstance); |
|
62 | + $this->app->register($object, $concreteInstance); |
|
63 | 63 | |
64 | 64 | // this method is executed if the concrete instance contains the handle method. |
65 | 65 | // if no handle method is included, the concrete instance is returned directly. |
66 | - (method_exists($concreteInstance,'handle')) |
|
66 | + (method_exists($concreteInstance, 'handle')) |
|
67 | 67 | ? $concreteInstance->handle() |
68 | 68 | : $concreteInstance; |
69 | 69 | |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | * @param null|string $value |
77 | 77 | * @return void |
78 | 78 | */ |
79 | - public function setKernelObject($object,$concrete,$value=null) |
|
79 | + public function setKernelObject($object, $concrete, $value = null) |
|
80 | 80 | { |
81 | 81 | //if a pre loader class wants to have before kernel values, |
82 | 82 | //it must return a callback to the bind method |
@@ -84,22 +84,22 @@ discard block |
||
84 | 84 | |
85 | 85 | //the value is directly assigned to the kernel object. |
86 | 86 | //The value is moved throughout the application in the kernel of the application object. |
87 | - if(is_null($value)){ |
|
88 | - $this->setKernel($object,$concrete); |
|
87 | + if (is_null($value)) { |
|
88 | + $this->setKernel($object, $concrete); |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | //The service container value is moved differently from the value directly assigned to the kernel object. |
92 | 92 | //The application container is booted directly with the service container custom class |
93 | 93 | //in the version section of the your application. |
94 | - if($value==="serviceContainer"){ |
|
95 | - $this->setServiceContainer($object,$concrete); |
|
94 | + if ($value==="serviceContainer") { |
|
95 | + $this->setServiceContainer($object, $concrete); |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | // we will resolve the value of concrete according to whether it is an object. |
99 | 99 | $detectorBindings = (is_object($concrete)) ? $concrete : Utils::resolverClass($concrete); |
100 | 100 | |
101 | 101 | //we register the bound object to the kernel bindings property. |
102 | - $this->app->register('bindings',$object,$detectorBindings); |
|
102 | + $this->app->register('bindings', $object, $detectorBindings); |
|
103 | 103 | |
104 | 104 | } |
105 | 105 | |
@@ -108,17 +108,17 @@ discard block |
||
108 | 108 | * @param $concrete |
109 | 109 | * @return void |
110 | 110 | */ |
111 | - private function setServiceContainer($object,$concrete) |
|
111 | + private function setServiceContainer($object, $concrete) |
|
112 | 112 | { |
113 | 113 | //We check that the concrete object |
114 | 114 | //is an object that can be retrieved. |
115 | - if(isset($this->app['serviceContainer']) && !isset($this->app['serviceContainer'][$object])){ |
|
115 | + if (isset($this->app['serviceContainer']) && !isset($this->app['serviceContainer'][$object])) { |
|
116 | 116 | |
117 | 117 | //the value corresponding to the bind value for the global object is assigned and |
118 | 118 | //the resolve method is called for the dependency method. |
119 | - $this->app->register('serviceContainer',$object,$concrete); |
|
119 | + $this->app->register('serviceContainer', $object, $concrete); |
|
120 | 120 | } |
121 | - else{ |
|
121 | + else { |
|
122 | 122 | |
123 | 123 | // the service container objects are saved only once. |
124 | 124 | // Overflow exception is thrown on multiple records. |
@@ -13,23 +13,23 @@ discard block |
||
13 | 13 | */ |
14 | 14 | public function getColoredString($string, $foreground_color = null, $background_color = null) |
15 | 15 | { |
16 | - $this->consoleLogger($string,'info'); |
|
16 | + $this->consoleLogger($string, 'info'); |
|
17 | 17 | |
18 | - if(isset($this->argument['commandCall'])) return $string; |
|
18 | + if (isset($this->argument['commandCall'])) return $string; |
|
19 | 19 | |
20 | 20 | $colored_string = ""; |
21 | 21 | |
22 | 22 | // Check if given foreground color found |
23 | 23 | if (isset($this->foreground_colors[$foreground_color])) { |
24 | - $colored_string .= "\033[" . $this->foreground_colors[$foreground_color] . "m"; |
|
24 | + $colored_string .= "\033[".$this->foreground_colors[$foreground_color]."m"; |
|
25 | 25 | } |
26 | 26 | // Check if given background color found |
27 | 27 | if (isset($this->background_colors[$background_color])) { |
28 | - $colored_string .= "\033[" . $this->background_colors[$background_color] . "m"; |
|
28 | + $colored_string .= "\033[".$this->background_colors[$background_color]."m"; |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | // Add string and end coloring |
32 | - $colored_string .= $string . "\033[0m"; |
|
32 | + $colored_string .= $string."\033[0m"; |
|
33 | 33 | |
34 | 34 | return $colored_string; |
35 | 35 | } |
@@ -43,25 +43,25 @@ discard block |
||
43 | 43 | */ |
44 | 44 | public function info($string, $foreground_color = 'blue', $background_color = 'white') |
45 | 45 | { |
46 | - $this->consoleLogger($string,'info'); |
|
46 | + $this->consoleLogger($string, 'info'); |
|
47 | 47 | |
48 | - if(isset($this->argument['commandCall'])) return $string; |
|
48 | + if (isset($this->argument['commandCall'])) return $string; |
|
49 | 49 | |
50 | 50 | $colored_string = ""; |
51 | 51 | |
52 | 52 | // Check if given foreground color found |
53 | 53 | if (isset($this->foreground_colors[$foreground_color])) { |
54 | - $colored_string .= "\033[" . $this->foreground_colors[$foreground_color] . "m"; |
|
54 | + $colored_string .= "\033[".$this->foreground_colors[$foreground_color]."m"; |
|
55 | 55 | } |
56 | 56 | // Check if given background color found |
57 | 57 | if (isset($this->background_colors[$background_color])) { |
58 | - $colored_string .= "\033[" . $this->background_colors[$background_color] . "m"; |
|
58 | + $colored_string .= "\033[".$this->background_colors[$background_color]."m"; |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | // Add string and end coloring |
62 | - $colored_string .= $string . "\033[0m"; |
|
62 | + $colored_string .= $string."\033[0m"; |
|
63 | 63 | |
64 | - return ''.$colored_string.'' . PHP_EOL; |
|
64 | + return ''.$colored_string.''.PHP_EOL; |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | /** |
@@ -71,19 +71,19 @@ discard block |
||
71 | 71 | */ |
72 | 72 | public function red($string, $foreground_color = 'red') |
73 | 73 | { |
74 | - $this->consoleLogger($string,'info'); |
|
74 | + $this->consoleLogger($string, 'info'); |
|
75 | 75 | |
76 | - if(isset($this->argument['commandCall'])) return $string; |
|
76 | + if (isset($this->argument['commandCall'])) return $string; |
|
77 | 77 | |
78 | 78 | $colored_string = ""; |
79 | 79 | |
80 | 80 | // Check if given foreground color found |
81 | 81 | if (isset($this->foreground_colors[$foreground_color])) { |
82 | - $colored_string .= "\033[" . $this->foreground_colors[$foreground_color] . "m"; |
|
82 | + $colored_string .= "\033[".$this->foreground_colors[$foreground_color]."m"; |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | // Add string and end coloring |
86 | - $colored_string .= $string . "\033[0m"; |
|
86 | + $colored_string .= $string."\033[0m"; |
|
87 | 87 | |
88 | 88 | return $colored_string; |
89 | 89 | } |
@@ -97,25 +97,25 @@ discard block |
||
97 | 97 | */ |
98 | 98 | public function success($string, $foreground_color = 'white', $background_color = 'yellow') |
99 | 99 | { |
100 | - $this->consoleLogger($string,'info'); |
|
100 | + $this->consoleLogger($string, 'info'); |
|
101 | 101 | |
102 | - if(isset($this->argument['commandCall'])) return $string; |
|
102 | + if (isset($this->argument['commandCall'])) return $string; |
|
103 | 103 | |
104 | 104 | $colored_string = ""; |
105 | 105 | |
106 | 106 | // Check if given foreground color found |
107 | 107 | if (isset($this->foreground_colors[$foreground_color])) { |
108 | - $colored_string .= "\033[" . $this->foreground_colors[$foreground_color] . "m"; |
|
108 | + $colored_string .= "\033[".$this->foreground_colors[$foreground_color]."m"; |
|
109 | 109 | } |
110 | 110 | // Check if given background color found |
111 | 111 | if (isset($this->background_colors[$background_color])) { |
112 | - $colored_string .= "\033[" . $this->background_colors[$background_color] . "m"; |
|
112 | + $colored_string .= "\033[".$this->background_colors[$background_color]."m"; |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | // Add string and end coloring |
116 | - $colored_string .= $string . "\033[0m"; |
|
116 | + $colored_string .= $string."\033[0m"; |
|
117 | 117 | |
118 | - return ''.$colored_string.'' . PHP_EOL; |
|
118 | + return ''.$colored_string.''.PHP_EOL; |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | /** |
@@ -126,25 +126,25 @@ discard block |
||
126 | 126 | */ |
127 | 127 | public function classical($string, $foreground_color = 'red', $background_color = 'white') |
128 | 128 | { |
129 | - $this->consoleLogger($string,'info'); |
|
129 | + $this->consoleLogger($string, 'info'); |
|
130 | 130 | |
131 | - if(isset($this->argument['commandCall'])) return $string; |
|
131 | + if (isset($this->argument['commandCall'])) return $string; |
|
132 | 132 | |
133 | 133 | $colored_string = ""; |
134 | 134 | |
135 | 135 | // Check if given foreground color found |
136 | 136 | if (isset($this->foreground_colors[$foreground_color])) { |
137 | - $colored_string .= "\033[" . $this->foreground_colors[$foreground_color] . "m"; |
|
137 | + $colored_string .= "\033[".$this->foreground_colors[$foreground_color]."m"; |
|
138 | 138 | } |
139 | 139 | // Check if given background color found |
140 | 140 | if (isset($this->background_colors[$background_color])) { |
141 | - $colored_string .= "\033[" . $this->background_colors[$background_color] . "m"; |
|
141 | + $colored_string .= "\033[".$this->background_colors[$background_color]."m"; |
|
142 | 142 | } |
143 | 143 | |
144 | 144 | // Add string and end coloring |
145 | - $colored_string .= $string . "\033[0m"; |
|
145 | + $colored_string .= $string."\033[0m"; |
|
146 | 146 | |
147 | - return ''.$colored_string.'' . PHP_EOL; |
|
147 | + return ''.$colored_string.''.PHP_EOL; |
|
148 | 148 | } |
149 | 149 | |
150 | 150 | /** |
@@ -155,25 +155,25 @@ discard block |
||
155 | 155 | */ |
156 | 156 | public function bluePrint($string, $foreground_color = 'blue', $background_color = 'white') |
157 | 157 | { |
158 | - $this->consoleLogger($string,'info'); |
|
158 | + $this->consoleLogger($string, 'info'); |
|
159 | 159 | |
160 | - if(isset($this->argument['commandCall'])) return $string; |
|
160 | + if (isset($this->argument['commandCall'])) return $string; |
|
161 | 161 | |
162 | 162 | $colored_string = ""; |
163 | 163 | |
164 | 164 | // Check if given foreground color found |
165 | 165 | if (isset($this->foreground_colors[$foreground_color])) { |
166 | - $colored_string .= "\033[" . $this->foreground_colors[$foreground_color] . "m"; |
|
166 | + $colored_string .= "\033[".$this->foreground_colors[$foreground_color]."m"; |
|
167 | 167 | } |
168 | 168 | // Check if given background color found |
169 | 169 | if (isset($this->background_colors[$background_color])) { |
170 | - $colored_string .= "\033[" . $this->background_colors[$background_color] . "m"; |
|
170 | + $colored_string .= "\033[".$this->background_colors[$background_color]."m"; |
|
171 | 171 | } |
172 | 172 | |
173 | 173 | // Add string and end coloring |
174 | - $colored_string .= $string . "\033[0m"; |
|
174 | + $colored_string .= $string."\033[0m"; |
|
175 | 175 | |
176 | - return ''.$colored_string.'' . PHP_EOL; |
|
176 | + return ''.$colored_string.''.PHP_EOL; |
|
177 | 177 | } |
178 | 178 | |
179 | 179 | /** |
@@ -184,25 +184,25 @@ discard block |
||
184 | 184 | */ |
185 | 185 | public function yellowPrint($string, $foreground_color = 'black', $background_color = 'yellow') |
186 | 186 | { |
187 | - $this->consoleLogger($string,'info'); |
|
187 | + $this->consoleLogger($string, 'info'); |
|
188 | 188 | |
189 | - if(isset($this->argument['commandCall'])) return $string; |
|
189 | + if (isset($this->argument['commandCall'])) return $string; |
|
190 | 190 | |
191 | 191 | $colored_string = ""; |
192 | 192 | |
193 | 193 | // Check if given foreground color found |
194 | 194 | if (isset($this->foreground_colors[$foreground_color])) { |
195 | - $colored_string .= "\033[" . $this->foreground_colors[$foreground_color] . "m"; |
|
195 | + $colored_string .= "\033[".$this->foreground_colors[$foreground_color]."m"; |
|
196 | 196 | } |
197 | 197 | // Check if given background color found |
198 | 198 | if (isset($this->background_colors[$background_color])) { |
199 | - $colored_string .= "\033[" . $this->background_colors[$background_color] . "m"; |
|
199 | + $colored_string .= "\033[".$this->background_colors[$background_color]."m"; |
|
200 | 200 | } |
201 | 201 | |
202 | 202 | // Add string and end coloring |
203 | - $colored_string .= $string . "\033[0m"; |
|
203 | + $colored_string .= $string."\033[0m"; |
|
204 | 204 | |
205 | - return ''.$colored_string.'' . PHP_EOL; |
|
205 | + return ''.$colored_string.''.PHP_EOL; |
|
206 | 206 | } |
207 | 207 | |
208 | 208 | /** |
@@ -213,25 +213,25 @@ discard block |
||
213 | 213 | */ |
214 | 214 | public function blue($string, $foreground_color = 'white', $background_color = 'blue') |
215 | 215 | { |
216 | - $this->consoleLogger($string,'info'); |
|
216 | + $this->consoleLogger($string, 'info'); |
|
217 | 217 | |
218 | - if(isset($this->argument['commandCall'])) return $string; |
|
218 | + if (isset($this->argument['commandCall'])) return $string; |
|
219 | 219 | |
220 | 220 | $colored_string = ""; |
221 | 221 | |
222 | 222 | // Check if given foreground color found |
223 | 223 | if (isset($this->foreground_colors[$foreground_color])) { |
224 | - $colored_string .= "\033[" . $this->foreground_colors[$foreground_color] . "m"; |
|
224 | + $colored_string .= "\033[".$this->foreground_colors[$foreground_color]."m"; |
|
225 | 225 | } |
226 | 226 | // Check if given background color found |
227 | 227 | if (isset($this->background_colors[$background_color])) { |
228 | - $colored_string .= "\033[" . $this->background_colors[$background_color] . "m"; |
|
228 | + $colored_string .= "\033[".$this->background_colors[$background_color]."m"; |
|
229 | 229 | } |
230 | 230 | |
231 | 231 | // Add string and end coloring |
232 | - $colored_string .= $string . "\033[0m"; |
|
232 | + $colored_string .= $string."\033[0m"; |
|
233 | 233 | |
234 | - return ''.$colored_string.'' . PHP_EOL; |
|
234 | + return ''.$colored_string.''.PHP_EOL; |
|
235 | 235 | } |
236 | 236 | |
237 | 237 | /** |
@@ -242,25 +242,25 @@ discard block |
||
242 | 242 | */ |
243 | 243 | public function yellow($string, $foreground_color = 'blue', $background_color = 'yellow') |
244 | 244 | { |
245 | - $this->consoleLogger($string,'info'); |
|
245 | + $this->consoleLogger($string, 'info'); |
|
246 | 246 | |
247 | - if(isset($this->argument['commandCall'])) return $string; |
|
247 | + if (isset($this->argument['commandCall'])) return $string; |
|
248 | 248 | |
249 | 249 | $colored_string = ""; |
250 | 250 | |
251 | 251 | // Check if given foreground color found |
252 | 252 | if (isset($this->foreground_colors[$foreground_color])) { |
253 | - $colored_string .= "\033[" . $this->foreground_colors[$foreground_color] . "m"; |
|
253 | + $colored_string .= "\033[".$this->foreground_colors[$foreground_color]."m"; |
|
254 | 254 | } |
255 | 255 | // Check if given background color found |
256 | 256 | if (isset($this->background_colors[$background_color])) { |
257 | - $colored_string .= "\033[" . $this->background_colors[$background_color] . "m"; |
|
257 | + $colored_string .= "\033[".$this->background_colors[$background_color]."m"; |
|
258 | 258 | } |
259 | 259 | |
260 | 260 | // Add string and end coloring |
261 | - $colored_string .= $string . "\033[0m"; |
|
261 | + $colored_string .= $string."\033[0m"; |
|
262 | 262 | |
263 | - return ''.$colored_string.'' . PHP_EOL; |
|
263 | + return ''.$colored_string.''.PHP_EOL; |
|
264 | 264 | } |
265 | 265 | |
266 | 266 | /** |
@@ -271,25 +271,25 @@ discard block |
||
271 | 271 | */ |
272 | 272 | public function cyan($string, $foreground_color = 'magenta', $background_color = 'cyan') |
273 | 273 | { |
274 | - $this->consoleLogger($string,'info'); |
|
274 | + $this->consoleLogger($string, 'info'); |
|
275 | 275 | |
276 | - if(isset($this->argument['commandCall'])) return $string; |
|
276 | + if (isset($this->argument['commandCall'])) return $string; |
|
277 | 277 | |
278 | 278 | $colored_string = ""; |
279 | 279 | |
280 | 280 | // Check if given foreground color found |
281 | 281 | if (isset($this->foreground_colors[$foreground_color])) { |
282 | - $colored_string .= "\033[" . $this->foreground_colors[$foreground_color] . "m"; |
|
282 | + $colored_string .= "\033[".$this->foreground_colors[$foreground_color]."m"; |
|
283 | 283 | } |
284 | 284 | // Check if given background color found |
285 | 285 | if (isset($this->background_colors[$background_color])) { |
286 | - $colored_string .= "\033[" . $this->background_colors[$background_color] . "m"; |
|
286 | + $colored_string .= "\033[".$this->background_colors[$background_color]."m"; |
|
287 | 287 | } |
288 | 288 | |
289 | 289 | // Add string and end coloring |
290 | - $colored_string .= $string . "\033[0m"; |
|
290 | + $colored_string .= $string."\033[0m"; |
|
291 | 291 | |
292 | - return ''.$colored_string.'' . PHP_EOL; |
|
292 | + return ''.$colored_string.''.PHP_EOL; |
|
293 | 293 | } |
294 | 294 | |
295 | 295 | /** |
@@ -300,23 +300,23 @@ discard block |
||
300 | 300 | */ |
301 | 301 | public function input($string, $foreground_color = 'blue', $background_color = 'light_gray') |
302 | 302 | { |
303 | - $this->consoleLogger($string,'info'); |
|
303 | + $this->consoleLogger($string, 'info'); |
|
304 | 304 | |
305 | - if(isset($this->argument['commandCall'])) return $string; |
|
305 | + if (isset($this->argument['commandCall'])) return $string; |
|
306 | 306 | |
307 | 307 | $colored_string = ""; |
308 | 308 | |
309 | 309 | // Check if given foreground color found |
310 | 310 | if (isset($this->foreground_colors[$foreground_color])) { |
311 | - $colored_string .= "\033[" . $this->foreground_colors[$foreground_color] . "m"; |
|
311 | + $colored_string .= "\033[".$this->foreground_colors[$foreground_color]."m"; |
|
312 | 312 | } |
313 | 313 | // Check if given background color found |
314 | 314 | if (isset($this->background_colors[$background_color])) { |
315 | - $colored_string .= "\033[" . $this->background_colors[$background_color] . "m"; |
|
315 | + $colored_string .= "\033[".$this->background_colors[$background_color]."m"; |
|
316 | 316 | } |
317 | 317 | |
318 | 318 | // Add string and end coloring |
319 | - $colored_string .= $string . "\033[0m"; |
|
319 | + $colored_string .= $string."\033[0m"; |
|
320 | 320 | |
321 | 321 | return ''.$colored_string.''; |
322 | 322 | } |
@@ -329,24 +329,24 @@ discard block |
||
329 | 329 | */ |
330 | 330 | public function error($string, $foreground_color = 'white', $background_color = 'red') |
331 | 331 | { |
332 | - $this->consoleLogger($string,'error'); |
|
332 | + $this->consoleLogger($string, 'error'); |
|
333 | 333 | |
334 | - if(isset($this->argument['commandCall'])) return $string; |
|
334 | + if (isset($this->argument['commandCall'])) return $string; |
|
335 | 335 | |
336 | 336 | $colored_string = ""; |
337 | 337 | |
338 | 338 | // Check if given foreground color found |
339 | 339 | if (isset($this->foreground_colors[$foreground_color])) { |
340 | - $colored_string .= "\033[" . $this->foreground_colors[$foreground_color] . "m"; |
|
340 | + $colored_string .= "\033[".$this->foreground_colors[$foreground_color]."m"; |
|
341 | 341 | } |
342 | 342 | // Check if given background color found |
343 | 343 | if (isset($this->background_colors[$background_color])) { |
344 | - $colored_string .= "\033[" . $this->background_colors[$background_color] . "m"; |
|
344 | + $colored_string .= "\033[".$this->background_colors[$background_color]."m"; |
|
345 | 345 | } |
346 | 346 | |
347 | 347 | // Add string and end coloring |
348 | - $colored_string .= "!!!! Error : ".$string . " \033[0m"; |
|
348 | + $colored_string .= "!!!! Error : ".$string." \033[0m"; |
|
349 | 349 | |
350 | - return ''.$colored_string.'' . PHP_EOL; |
|
350 | + return ''.$colored_string.''.PHP_EOL; |
|
351 | 351 | } |
352 | 352 | } |
353 | 353 | \ No newline at end of file |
@@ -15,7 +15,9 @@ discard block |
||
15 | 15 | { |
16 | 16 | $this->consoleLogger($string,'info'); |
17 | 17 | |
18 | - if(isset($this->argument['commandCall'])) return $string; |
|
18 | + if(isset($this->argument['commandCall'])) { |
|
19 | + return $string; |
|
20 | + } |
|
19 | 21 | |
20 | 22 | $colored_string = ""; |
21 | 23 | |
@@ -45,7 +47,9 @@ discard block |
||
45 | 47 | { |
46 | 48 | $this->consoleLogger($string,'info'); |
47 | 49 | |
48 | - if(isset($this->argument['commandCall'])) return $string; |
|
50 | + if(isset($this->argument['commandCall'])) { |
|
51 | + return $string; |
|
52 | + } |
|
49 | 53 | |
50 | 54 | $colored_string = ""; |
51 | 55 | |
@@ -73,7 +77,9 @@ discard block |
||
73 | 77 | { |
74 | 78 | $this->consoleLogger($string,'info'); |
75 | 79 | |
76 | - if(isset($this->argument['commandCall'])) return $string; |
|
80 | + if(isset($this->argument['commandCall'])) { |
|
81 | + return $string; |
|
82 | + } |
|
77 | 83 | |
78 | 84 | $colored_string = ""; |
79 | 85 | |
@@ -99,7 +105,9 @@ discard block |
||
99 | 105 | { |
100 | 106 | $this->consoleLogger($string,'info'); |
101 | 107 | |
102 | - if(isset($this->argument['commandCall'])) return $string; |
|
108 | + if(isset($this->argument['commandCall'])) { |
|
109 | + return $string; |
|
110 | + } |
|
103 | 111 | |
104 | 112 | $colored_string = ""; |
105 | 113 | |
@@ -128,7 +136,9 @@ discard block |
||
128 | 136 | { |
129 | 137 | $this->consoleLogger($string,'info'); |
130 | 138 | |
131 | - if(isset($this->argument['commandCall'])) return $string; |
|
139 | + if(isset($this->argument['commandCall'])) { |
|
140 | + return $string; |
|
141 | + } |
|
132 | 142 | |
133 | 143 | $colored_string = ""; |
134 | 144 | |
@@ -157,7 +167,9 @@ discard block |
||
157 | 167 | { |
158 | 168 | $this->consoleLogger($string,'info'); |
159 | 169 | |
160 | - if(isset($this->argument['commandCall'])) return $string; |
|
170 | + if(isset($this->argument['commandCall'])) { |
|
171 | + return $string; |
|
172 | + } |
|
161 | 173 | |
162 | 174 | $colored_string = ""; |
163 | 175 | |
@@ -186,7 +198,9 @@ discard block |
||
186 | 198 | { |
187 | 199 | $this->consoleLogger($string,'info'); |
188 | 200 | |
189 | - if(isset($this->argument['commandCall'])) return $string; |
|
201 | + if(isset($this->argument['commandCall'])) { |
|
202 | + return $string; |
|
203 | + } |
|
190 | 204 | |
191 | 205 | $colored_string = ""; |
192 | 206 | |
@@ -215,7 +229,9 @@ discard block |
||
215 | 229 | { |
216 | 230 | $this->consoleLogger($string,'info'); |
217 | 231 | |
218 | - if(isset($this->argument['commandCall'])) return $string; |
|
232 | + if(isset($this->argument['commandCall'])) { |
|
233 | + return $string; |
|
234 | + } |
|
219 | 235 | |
220 | 236 | $colored_string = ""; |
221 | 237 | |
@@ -244,7 +260,9 @@ discard block |
||
244 | 260 | { |
245 | 261 | $this->consoleLogger($string,'info'); |
246 | 262 | |
247 | - if(isset($this->argument['commandCall'])) return $string; |
|
263 | + if(isset($this->argument['commandCall'])) { |
|
264 | + return $string; |
|
265 | + } |
|
248 | 266 | |
249 | 267 | $colored_string = ""; |
250 | 268 | |
@@ -273,7 +291,9 @@ discard block |
||
273 | 291 | { |
274 | 292 | $this->consoleLogger($string,'info'); |
275 | 293 | |
276 | - if(isset($this->argument['commandCall'])) return $string; |
|
294 | + if(isset($this->argument['commandCall'])) { |
|
295 | + return $string; |
|
296 | + } |
|
277 | 297 | |
278 | 298 | $colored_string = ""; |
279 | 299 | |
@@ -302,7 +322,9 @@ discard block |
||
302 | 322 | { |
303 | 323 | $this->consoleLogger($string,'info'); |
304 | 324 | |
305 | - if(isset($this->argument['commandCall'])) return $string; |
|
325 | + if(isset($this->argument['commandCall'])) { |
|
326 | + return $string; |
|
327 | + } |
|
306 | 328 | |
307 | 329 | $colored_string = ""; |
308 | 330 | |
@@ -331,7 +353,9 @@ discard block |
||
331 | 353 | { |
332 | 354 | $this->consoleLogger($string,'error'); |
333 | 355 | |
334 | - if(isset($this->argument['commandCall'])) return $string; |
|
356 | + if(isset($this->argument['commandCall'])) { |
|
357 | + return $string; |
|
358 | + } |
|
335 | 359 | |
336 | 360 | $colored_string = ""; |
337 | 361 |
@@ -17,7 +17,7 @@ |
||
17 | 17 | * @param $offset |
18 | 18 | * @param $value |
19 | 19 | */ |
20 | - final public function offsetSet($offset,$value) |
|
20 | + final public function offsetSet($offset, $value) |
|
21 | 21 | { |
22 | 22 | $this->{$offset} = $value; |
23 | 23 | } |
@@ -161,8 +161,7 @@ |
||
161 | 161 | |
162 | 162 | if($fromRoutes['namespace']===null){ |
163 | 163 | $namespace = Utils::getNamespace($fromRoutes['controller']).'\\'.$fromRoutesClass; |
164 | - } |
|
165 | - else{ |
|
164 | + } else{ |
|
166 | 165 | $namespace = Utils::getNamespace($fromRoutes['controller']).'\\'.$fromRoutes['namespace'].'\\'.$fromRoutesClass; |
167 | 166 | } |
168 | 167 | } |
@@ -56,8 +56,8 @@ discard block |
||
56 | 56 | */ |
57 | 57 | public function resolveMethod($method) |
58 | 58 | { |
59 | - $method=str_replace(httpMethod(),'',$method); |
|
60 | - $method=str_replace(StaticPathModel::$methodPrefix,'',$method); |
|
59 | + $method = str_replace(httpMethod(), '', $method); |
|
60 | + $method = str_replace(StaticPathModel::$methodPrefix, '', $method); |
|
61 | 61 | return $method; |
62 | 62 | } |
63 | 63 | |
@@ -105,16 +105,16 @@ discard block |
||
105 | 105 | //If controller does not have a method after checking whether the method specified in the controller class exists, |
106 | 106 | //then by default we assign a default method value of indexAction. |
107 | 107 | //This value must match the class strictly, otherwise the controller can not be called |
108 | - if(method_exists($this->app['instanceController'],$this->getPrefixMethod())){ |
|
108 | + if (method_exists($this->app['instanceController'], $this->getPrefixMethod())) { |
|
109 | 109 | |
110 | 110 | //method value as normal |
111 | - return $this->setViaDefine($this->getPrefixMethod(),$globalInstance); |
|
111 | + return $this->setViaDefine($this->getPrefixMethod(), $globalInstance); |
|
112 | 112 | } |
113 | 113 | |
114 | 114 | //by default we assign a default method value of indexAction |
115 | 115 | //this value must be a method value automatically named indexAction |
116 | 116 | //if it does not come from the url discovery value |
117 | - return $this->setViaDefine($this->getPrefixIndexMethod(),$globalInstance); |
|
117 | + return $this->setViaDefine($this->getPrefixIndexMethod(), $globalInstance); |
|
118 | 118 | } |
119 | 119 | |
120 | 120 | /** |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | { |
126 | 126 | //If the path variables give values in the methods do we have a method name, |
127 | 127 | //we subtract this value from the route variables. |
128 | - return array_values(array_diff(core()->routeParameters,[$method])); |
|
128 | + return array_values(array_diff(core()->routeParameters, [$method])); |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | /** |
@@ -133,12 +133,12 @@ discard block |
||
133 | 133 | * @param $globalInstance Router |
134 | 134 | * @return mixed |
135 | 135 | */ |
136 | - private function setViaDefine($method,$globalInstance) |
|
136 | + private function setViaDefine($method, $globalInstance) |
|
137 | 137 | { |
138 | 138 | // we are extracting httpMethod and prefix from |
139 | 139 | // the method variable so that we can extract the salt method name. |
140 | - $deleteHttp = str_replace(httpMethod(),'',$method); |
|
141 | - $methodName = str_replace(StaticPathModel::$methodPrefix,'',$deleteHttp); |
|
140 | + $deleteHttp = str_replace(httpMethod(), '', $method); |
|
141 | + $methodName = str_replace(StaticPathModel::$methodPrefix, '', $deleteHttp); |
|
142 | 142 | |
143 | 143 | //set as global method name |
144 | 144 | $globalInstance->setMethodNameViaDefine($methodName); |
@@ -156,19 +156,19 @@ discard block |
||
156 | 156 | $fromRoutes = Route::getRouteResolve(); |
157 | 157 | $namespace = null; |
158 | 158 | |
159 | - if(count($fromRoutes)){ |
|
160 | - $fromRoutesClass = (isset($fromRoutes['class'])) ? $fromRoutes['class'] : null; |
|
159 | + if (count($fromRoutes)) { |
|
160 | + $fromRoutesClass = (isset($fromRoutes['class'])) ? $fromRoutes['class'] : null; |
|
161 | 161 | |
162 | - if($fromRoutes['namespace']===null){ |
|
162 | + if ($fromRoutes['namespace']===null) { |
|
163 | 163 | $namespace = Utils::getNamespace($fromRoutes['controller']).'\\'.$fromRoutesClass; |
164 | 164 | } |
165 | - else{ |
|
165 | + else { |
|
166 | 166 | $namespace = Utils::getNamespace($fromRoutes['controller']).'\\'.$fromRoutes['namespace'].'\\'.$fromRoutesClass; |
167 | 167 | } |
168 | 168 | } |
169 | 169 | |
170 | 170 | //check namespace exists |
171 | - if(Utils::isNamespaceExists($namespace)){ |
|
171 | + if (Utils::isNamespaceExists($namespace)) { |
|
172 | 172 | |
173 | 173 | // the controller classes are registered in the config controller. |
174 | 174 | // the controller class is not executed if it is not available here. |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | public function checkAutoService($instance) |
189 | 189 | { |
190 | 190 | //If auto service is present, this auto service will be accepted as endpoint namespace. |
191 | - return $this->checkEndpointForAutoService()->getNamespaceForAutoService($instance,function(){ |
|
191 | + return $this->checkEndpointForAutoService()->getNamespaceForAutoService($instance, function() { |
|
192 | 192 | exception()->notFoundException('Any endpoint is not available'); |
193 | 193 | }); |
194 | 194 | } |
@@ -200,19 +200,19 @@ discard block |
||
200 | 200 | { |
201 | 201 | $configController = config('controller'); |
202 | 202 | |
203 | - if($configController===null |
|
203 | + if ($configController===null |
|
204 | 204 | OR !isset($configController[$this->endpoint()]) |
205 | - or !isset($configController[$this->endpoint()][$namespace])){ |
|
205 | + or !isset($configController[$this->endpoint()][$namespace])) { |
|
206 | 206 | exception()->badFunctionCall('The request has not been saved in your configuration settings.'); |
207 | 207 | } |
208 | 208 | |
209 | 209 | $configController = $configController[$this->endpoint()][$namespace]; |
210 | 210 | |
211 | - if(isset($configController[environment()]) and $configController[environment()]===false){ |
|
211 | + if (isset($configController[environment()]) and $configController[environment()]===false) { |
|
212 | 212 | exception()->domain('Sorry, this endpoint is not allowed to run for this environment.'); |
213 | 213 | } |
214 | 214 | |
215 | - if(isset($configController['all']) AND $configController['all']===false){ |
|
215 | + if (isset($configController['all']) AND $configController['all']===false) { |
|
216 | 216 | exception()->domain('Sorry, this endpoint is never allowed to run.'); |
217 | 217 | } |
218 | 218 | } |