@@ -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 | |
@@ -49,13 +49,13 @@ discard block |
||
| 49 | 49 | |
| 50 | 50 | //we can use this method to move an instance of the application class with the kernel object |
| 51 | 51 | //and easily resolve an encrypted instance of all the kernel variables in our helper class. |
| 52 | - ClassAliasGroup::setAlias(App::class,'application'); |
|
| 52 | + ClassAliasGroup::setAlias(App::class, 'application'); |
|
| 53 | 53 | |
| 54 | 54 | //set base instances |
| 55 | 55 | $this->setBaseInstances(); |
| 56 | 56 | |
| 57 | 57 | //we define the general application instance object. |
| 58 | - define('appInstance',(base64_encode(serialize($this->app))));
|
|
| 58 | + define('appInstance', (base64_encode(serialize($this->app))));
|
|
| 59 | 59 | |
| 60 | 60 | //main loader for application |
| 61 | 61 | $this->mainLoader(); |
@@ -70,8 +70,8 @@ discard block |
||
| 70 | 70 | // this function can be used for defining your own way of handling errors during runtime, |
| 71 | 71 | // for example in applications in which you need to do cleanup of data/files when a critical error happens, |
| 72 | 72 | // or when you need to trigger an error under certain conditions (using trigger_error()). |
| 73 | - if($this->app['isAvailableStore']){
|
|
| 74 | - $this->app->make('exception',function(){
|
|
| 73 | + if ($this->app['isAvailableStore']) {
|
|
| 74 | + $this->app->make('exception', function() {
|
|
| 75 | 75 | return ErrorProvider::class; |
| 76 | 76 | }); |
| 77 | 77 | } |
@@ -86,33 +86,33 @@ discard block |
||
| 86 | 86 | {
|
| 87 | 87 | // for revision records, |
| 88 | 88 | // the master key is assigned as revision. |
| 89 | - $this->app->register('revision',[]);
|
|
| 89 | + $this->app->register('revision', []);
|
|
| 90 | 90 | |
| 91 | 91 | //we're saving the directory where kernel files are running to the kernel object. |
| 92 | - $this->app->register('corePath',str_replace('Foundation','',__DIR__.''));
|
|
| 92 | + $this->app->register('corePath', str_replace('Foundation', '', __DIR__.''));
|
|
| 93 | 93 | |
| 94 | 94 | //For the application, we create the object that the register method, |
| 95 | 95 | // which is the container center, is connected to by the kernel object register method. |
| 96 | - $this->app->register('container',$this->app);
|
|
| 96 | + $this->app->register('container', $this->app);
|
|
| 97 | 97 | |
| 98 | 98 | // We are saving the application class to |
| 99 | 99 | // the container object for the appClass value. |
| 100 | - $this->app->register('appClass',new App());
|
|
| 100 | + $this->app->register('appClass', new App());
|
|
| 101 | 101 | |
| 102 | 102 | //set closure bind instance for application |
| 103 | - $this->app->register('appClosureInstance',ClosureDispatcher::bind(app()));
|
|
| 103 | + $this->app->register('appClosureInstance', ClosureDispatcher::bind(app()));
|
|
| 104 | 104 | |
| 105 | 105 | //set closure bind instance for bootLoader class |
| 106 | - $this->app->register('closureBootLoader',ClosureDispatcher::bind($this->app['bootLoader']));
|
|
| 106 | + $this->app->register('closureBootLoader', ClosureDispatcher::bind($this->app['bootLoader']));
|
|
| 107 | 107 | |
| 108 | 108 | //set register for macro |
| 109 | - $this->app->register('macro',$this->app->resolve(Macro::class));
|
|
| 109 | + $this->app->register('macro', $this->app->resolve(Macro::class));
|
|
| 110 | 110 | |
| 111 | 111 | //set register for macro |
| 112 | - $this->app->register('pipeline',new Pipeline());
|
|
| 112 | + $this->app->register('pipeline', new Pipeline());
|
|
| 113 | 113 | |
| 114 | - $this->app->register('di',function($instance,$method){
|
|
| 115 | - return DIContainerManager::callBind([$instance,$method],$this->app->applicationProviderBinding($this->app)); |
|
| 114 | + $this->app->register('di', function($instance, $method) {
|
|
| 115 | + return DIContainerManager::callBind([$instance, $method], $this->app->applicationProviderBinding($this->app)); |
|
| 116 | 116 | }); |
| 117 | 117 | |
| 118 | 118 | } |
@@ -127,10 +127,10 @@ discard block |
||
| 127 | 127 | //register as instance application object |
| 128 | 128 | // and container instance resolve |
| 129 | 129 | //set core instance value |
| 130 | - $this->app->instance('container',$this->app->singleton());
|
|
| 131 | - $this->app->instance('bootLoader',$this->app->resolve(BootLoader::class));
|
|
| 132 | - $this->app->instance('containerInstanceResolve',ContainerInstanceResolver::class);
|
|
| 133 | - $this->app->instance('reflection',ReflectionProcess::class);
|
|
| 130 | + $this->app->instance('container', $this->app->singleton());
|
|
| 131 | + $this->app->instance('bootLoader', $this->app->resolve(BootLoader::class));
|
|
| 132 | + $this->app->instance('containerInstanceResolve', ContainerInstanceResolver::class);
|
|
| 133 | + $this->app->instance('reflection', ReflectionProcess::class);
|
|
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | /** |
@@ -139,24 +139,24 @@ discard block |
||
| 139 | 139 | private function setGlobalAccessor() |
| 140 | 140 | {
|
| 141 | 141 | //get response success and status |
| 142 | - $this->app->register('instanceController',null);
|
|
| 143 | - $this->app->register('responseSuccess',true);
|
|
| 144 | - $this->app->register('responseStatus',200);
|
|
| 145 | - $this->app->register('responseType','json');
|
|
| 142 | + $this->app->register('instanceController', null);
|
|
| 143 | + $this->app->register('responseSuccess', true);
|
|
| 144 | + $this->app->register('responseStatus', 200);
|
|
| 145 | + $this->app->register('responseType', 'json');
|
|
| 146 | 146 | |
| 147 | 147 | //we first load the response class as a singleton object to allow you to send output anywhere |
| 148 | - $this->app->register('out',$this->app->resolve(ResponseProvider::class));
|
|
| 148 | + $this->app->register('out', $this->app->resolve(ResponseProvider::class));
|
|
| 149 | 149 | |
| 150 | 150 | $parametersYaml = $this->app()->path()->app().'parameters.yaml'; |
| 151 | - if(file_exists($parametersYaml)){
|
|
| 152 | - $this->app()->register('parametersYaml',(Utils::yaml($parametersYaml))->get());
|
|
| 151 | + if (file_exists($parametersYaml)) {
|
|
| 152 | + $this->app()->register('parametersYaml', (Utils::yaml($parametersYaml))->get());
|
|
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | $requestService = "Store\Services\RequestService"; |
| 156 | 156 | |
| 157 | 157 | //The HttpFoundation component defines an object-oriented layer for the HTTP specification. |
| 158 | 158 | //The HttpFoundation component replaces these default PHP global variables and functions by an object-oriented layer |
| 159 | - if(Utils::isNamespaceExists($requestService)){
|
|
| 159 | + if (Utils::isNamespaceExists($requestService)) {
|
|
| 160 | 160 | |
| 161 | 161 | Request::setFactory(function(array $query = array(), |
| 162 | 162 | array $request = array(), |
@@ -178,16 +178,16 @@ discard block |
||
| 178 | 178 | |
| 179 | 179 | |
| 180 | 180 | //After registering the symfony request method, we also save the get and post methods for user convenience. |
| 181 | - $this->app->register('request',Request::createFromGlobals());
|
|
| 182 | - $this->app->register('get',core()->request->query->all());
|
|
| 183 | - $this->app->register('post',core()->request->request->all());
|
|
| 181 | + $this->app->register('request', Request::createFromGlobals());
|
|
| 182 | + $this->app->register('get', core()->request->query->all());
|
|
| 183 | + $this->app->register('post', core()->request->request->all());
|
|
| 184 | 184 | |
| 185 | 185 | //We determine with the kernel object which HTTP method the requested from the client |
| 186 | - $this->app->register('httpMethod',ucfirst(strtolower(core()->request->getRealMethod())));
|
|
| 186 | + $this->app->register('httpMethod', ucfirst(strtolower(core()->request->getRealMethod())));
|
|
| 187 | 187 | |
| 188 | - define('httpMethod',strtoupper(core()->httpMethod));
|
|
| 188 | + define('httpMethod', strtoupper(core()->httpMethod));
|
|
| 189 | 189 | |
| 190 | - $this->app->register('fileSystem',new FileProcess());
|
|
| 190 | + $this->app->register('fileSystem', new FileProcess());
|
|
| 191 | 191 | } |
| 192 | 192 | |
| 193 | 193 | } |
| 194 | 194 | \ No newline at end of file |