@@ -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 |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | */ |
49 | 49 | function applicationKey() |
50 | 50 | { |
51 | - if(property_exists($kernel=app()->kernel(),'applicationKey')){ |
|
51 | + if (property_exists($kernel = app()->kernel(), 'applicationKey')) { |
|
52 | 52 | return $kernel->applicationKey; |
53 | 53 | } |
54 | 54 | return null; |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | */ |
82 | 82 | function bundleName() |
83 | 83 | { |
84 | - if(defined('endpoint')){ |
|
84 | + if (defined('endpoint')) { |
|
85 | 85 | |
86 | 86 | return endpoint.''.StaticPathList::$controllerBundleName; |
87 | 87 | } |
@@ -96,11 +96,11 @@ discard block |
||
96 | 96 | * @param null $default |
97 | 97 | * @return mixed|null |
98 | 98 | */ |
99 | - function config($config=null,$default=null) |
|
99 | + function config($config = null, $default = null) |
|
100 | 100 | { |
101 | 101 | $configResult = app()->config($config); |
102 | 102 | |
103 | - if($configResult === null && $default!==null){ |
|
103 | + if ($configResult===null && $default!==null) { |
|
104 | 104 | return $default; |
105 | 105 | } |
106 | 106 | |
@@ -115,9 +115,9 @@ discard block |
||
115 | 115 | * @param $bind array |
116 | 116 | * @return mixed |
117 | 117 | */ |
118 | - function container($class,$bind=array()) |
|
118 | + function container($class, $bind = array()) |
|
119 | 119 | { |
120 | - return app()->singleton()->appClass->container(appInstance(),$class,$bind); |
|
120 | + return app()->singleton()->appClass->container(appInstance(), $class, $bind); |
|
121 | 121 | } |
122 | 122 | } |
123 | 123 | |
@@ -177,10 +177,10 @@ discard block |
||
177 | 177 | * @param array $params |
178 | 178 | * @return ExceptionContracts |
179 | 179 | */ |
180 | - function exception($name=null,$params=array()) |
|
180 | + function exception($name = null, $params = array()) |
|
181 | 181 | { |
182 | - $exceptionManager=ExceptionManager::class; |
|
183 | - return app()->resolve($exceptionManager,['name'=>$name,'params'=>$params]); |
|
182 | + $exceptionManager = ExceptionManager::class; |
|
183 | + return app()->resolve($exceptionManager, ['name'=>$name, 'params'=>$params]); |
|
184 | 184 | } |
185 | 185 | } |
186 | 186 | |
@@ -190,13 +190,13 @@ discard block |
||
190 | 190 | * @param null $locale |
191 | 191 | * @return Generator |
192 | 192 | */ |
193 | - function faker($locale=null) |
|
193 | + function faker($locale = null) |
|
194 | 194 | { |
195 | - if($locale===null){ |
|
196 | - $faker=Factory::create(); |
|
195 | + if ($locale===null) { |
|
196 | + $faker = Factory::create(); |
|
197 | 197 | } |
198 | - else{ |
|
199 | - $faker=Factory::create($locale); |
|
198 | + else { |
|
199 | + $faker = Factory::create($locale); |
|
200 | 200 | } |
201 | 201 | |
202 | 202 | return $faker; |
@@ -207,8 +207,8 @@ discard block |
||
207 | 207 | |
208 | 208 | function fingerPrint() |
209 | 209 | { |
210 | - return md5(sha1(implode("|",[ |
|
211 | - request()->getClientIp(),applicationKey() |
|
210 | + return md5(sha1(implode("|", [ |
|
211 | + request()->getClientIp(), applicationKey() |
|
212 | 212 | ]))); |
213 | 213 | } |
214 | 214 | } |
@@ -228,10 +228,10 @@ discard block |
||
228 | 228 | * @param null $default |
229 | 229 | * @return null |
230 | 230 | */ |
231 | - function get($param=null,$default=null) |
|
231 | + function get($param = null, $default = null) |
|
232 | 232 | { |
233 | 233 | //symfony request query object |
234 | - $get=core()->get; |
|
234 | + $get = core()->get; |
|
235 | 235 | |
236 | 236 | return ($param===null) ? $get : (isset($get[$param]) ? $get[$param] : $default); |
237 | 237 | } |
@@ -244,14 +244,14 @@ discard block |
||
244 | 244 | * @param null $default |
245 | 245 | * @return array|string |
246 | 246 | */ |
247 | - function headers($param=null,$default=null) |
|
247 | + function headers($param = null, $default = null) |
|
248 | 248 | { |
249 | - $list=[]; |
|
249 | + $list = []; |
|
250 | 250 | |
251 | 251 | //We only get the objects in the list name to match the header objects |
252 | 252 | //that come with the request path to the objects sent by the client |
253 | 253 | foreach (request()->headers->all() as $key=>$value) { |
254 | - $list[$key]=$value; |
|
254 | + $list[$key] = $value; |
|
255 | 255 | } |
256 | 256 | |
257 | 257 | //return header list |
@@ -276,9 +276,9 @@ discard block |
||
276 | 276 | * @param $file null |
277 | 277 | * @return LoggerHandler |
278 | 278 | */ |
279 | - function logger($file=null) |
|
279 | + function logger($file = null) |
|
280 | 280 | { |
281 | - return app()->resolve(LoggerHandler::class,['file'=>$file]); |
|
281 | + return app()->resolve(LoggerHandler::class, ['file'=>$file]); |
|
282 | 282 | } |
283 | 283 | } |
284 | 284 | |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | */ |
301 | 301 | function response() |
302 | 302 | { |
303 | - $object=debug_backtrace()[1]['object']; |
|
303 | + $object = debug_backtrace()[1]['object']; |
|
304 | 304 | return new ResponseOutManager($object); |
305 | 305 | } |
306 | 306 | } |
@@ -315,9 +315,9 @@ discard block |
||
315 | 315 | * @throws \DI\DependencyException |
316 | 316 | * @throws \DI\NotFoundException |
317 | 317 | */ |
318 | - function resolve($class,$bind=array()) |
|
318 | + function resolve($class, $bind = array()) |
|
319 | 319 | { |
320 | - return app()->resolve($class,$bind); |
|
320 | + return app()->resolve($class, $bind); |
|
321 | 321 | } |
322 | 322 | } |
323 | 323 | |
@@ -328,7 +328,7 @@ discard block |
||
328 | 328 | */ |
329 | 329 | function policy() |
330 | 330 | { |
331 | - $policyPath = implode('/',[ |
|
331 | + $policyPath = implode('/', [ |
|
332 | 332 | Route::getRouteControllerNamespace(), |
333 | 333 | 'Policy', |
334 | 334 | Route::getRouteControllerClass().'Policy' |
@@ -336,7 +336,7 @@ discard block |
||
336 | 336 | |
337 | 337 | $policyNamespace = Utils::getNamespace($policyPath); |
338 | 338 | |
339 | - if(Utils::isNamespaceExists($policyNamespace)){ |
|
339 | + if (Utils::isNamespaceExists($policyNamespace)) { |
|
340 | 340 | return app()->resolve(Utils::getNamespace($policyPath)); |
341 | 341 | } |
342 | 342 | |
@@ -351,10 +351,10 @@ discard block |
||
351 | 351 | * @param $key |
352 | 352 | * @return mixed |
353 | 353 | */ |
354 | - function route($key=null) |
|
354 | + function route($key = null) |
|
355 | 355 | { |
356 | - if(is_null($key)){ |
|
357 | - return array_map(function($route){ |
|
356 | + if (is_null($key)) { |
|
357 | + return array_map(function($route) { |
|
358 | 358 | return strtolower($route); |
359 | 359 | },app()->singleton()->appClass->route($key)); |
360 | 360 | } |
@@ -382,10 +382,10 @@ discard block |
||
382 | 382 | * @param null $default |
383 | 383 | * @return mixed |
384 | 384 | */ |
385 | - function post($param=null,$default=null) |
|
385 | + function post($param = null, $default = null) |
|
386 | 386 | { |
387 | 387 | //symfony request query object |
388 | - $post=core()->post; |
|
388 | + $post = core()->post; |
|
389 | 389 | |
390 | 390 | return ($param===null) ? $post : (isset($post[$param]) ? $post[$param] : $default); |
391 | 391 | } |
@@ -416,8 +416,8 @@ discard block |
||
416 | 416 | * @param array $select |
417 | 417 | * @return mixed |
418 | 418 | */ |
419 | - function trans($lang,$select=array()) |
|
419 | + function trans($lang, $select = array()) |
|
420 | 420 | { |
421 | - return app()->singleton()->appClass->translator($lang,$select); |
|
421 | + return app()->singleton()->appClass->translator($lang, $select); |
|
422 | 422 | } |
423 | 423 | } |
424 | 424 | \ No newline at end of file |