@@ -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,13 +69,13 @@ 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 | } |
| 77 | 77 | |
| 78 | - if(!isset($_SERVER['HTTP_USER_AGENT'])){
|
|
| 78 | + if (!isset($_SERVER['HTTP_USER_AGENT'])) {
|
|
| 79 | 79 | $_SERVER['HTTP_USER_AGENT'] = 'no_user_agent'; |
| 80 | 80 | } |
| 81 | 81 | } |
@@ -89,33 +89,33 @@ discard block |
||
| 89 | 89 | {
|
| 90 | 90 | // for revision records, |
| 91 | 91 | // the master key is assigned as revision. |
| 92 | - $this->app->register('revision',[]);
|
|
| 92 | + $this->app->register('revision', []);
|
|
| 93 | 93 | |
| 94 | 94 | //we're saving the directory where kernel files are running to the kernel object. |
| 95 | - $this->app->register('corePath',str_replace('Foundation','',__DIR__.''));
|
|
| 95 | + $this->app->register('corePath', str_replace('Foundation', '', __DIR__.''));
|
|
| 96 | 96 | |
| 97 | 97 | //For the application, we create the object that the register method, |
| 98 | 98 | // which is the container center, is connected to by the kernel object register method. |
| 99 | - $this->app->register('container',$this->app);
|
|
| 99 | + $this->app->register('container', $this->app);
|
|
| 100 | 100 | |
| 101 | 101 | // We are saving the application class to |
| 102 | 102 | // the container object for the appClass value. |
| 103 | - $this->app->register('appClass',new App());
|
|
| 103 | + $this->app->register('appClass', new App());
|
|
| 104 | 104 | |
| 105 | 105 | //set closure bind instance for application |
| 106 | - $this->app->register('appClosureInstance',ClosureDispatcher::bind(app()));
|
|
| 106 | + $this->app->register('appClosureInstance', ClosureDispatcher::bind(app()));
|
|
| 107 | 107 | |
| 108 | 108 | //set closure bind instance for bootLoader class |
| 109 | - $this->app->register('closureBootLoader',ClosureDispatcher::bind($this->app['bootLoader']));
|
|
| 109 | + $this->app->register('closureBootLoader', ClosureDispatcher::bind($this->app['bootLoader']));
|
|
| 110 | 110 | |
| 111 | 111 | //set register for macro |
| 112 | - $this->app->register('macro',$this->app->resolve(Macro::class));
|
|
| 112 | + $this->app->register('macro', $this->app->resolve(Macro::class));
|
|
| 113 | 113 | |
| 114 | 114 | //set register for macro |
| 115 | - $this->app->register('pipeline',new Pipeline());
|
|
| 115 | + $this->app->register('pipeline', new Pipeline());
|
|
| 116 | 116 | |
| 117 | - $this->app->register('di',function($instance,$method){
|
|
| 118 | - return DIContainerManager::callBind([$instance,$method],$this->app->applicationProviderBinding($this->app)); |
|
| 117 | + $this->app->register('di', function($instance, $method) {
|
|
| 118 | + return DIContainerManager::callBind([$instance, $method], $this->app->applicationProviderBinding($this->app)); |
|
| 119 | 119 | }); |
| 120 | 120 | |
| 121 | 121 | } |
@@ -130,10 +130,10 @@ discard block |
||
| 130 | 130 | //register as instance application object |
| 131 | 131 | // and container instance resolve |
| 132 | 132 | //set core instance value |
| 133 | - $this->app->instance('container',$this->app->singleton());
|
|
| 134 | - $this->app->instance('bootLoader',$this->app->resolve(BootLoader::class));
|
|
| 135 | - $this->app->instance('containerInstanceResolve',ContainerInstanceResolver::class);
|
|
| 136 | - $this->app->instance('reflection',ReflectionProcess::class);
|
|
| 133 | + $this->app->instance('container', $this->app->singleton());
|
|
| 134 | + $this->app->instance('bootLoader', $this->app->resolve(BootLoader::class));
|
|
| 135 | + $this->app->instance('containerInstanceResolve', ContainerInstanceResolver::class);
|
|
| 136 | + $this->app->instance('reflection', ReflectionProcess::class);
|
|
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | /** |
@@ -142,19 +142,19 @@ discard block |
||
| 142 | 142 | private function setGlobalAccessor() |
| 143 | 143 | {
|
| 144 | 144 | //get response success and status |
| 145 | - $this->app->register('instanceController',null);
|
|
| 146 | - $this->app->register('responseSuccess',true);
|
|
| 147 | - $this->app->register('responseStatus',200);
|
|
| 148 | - $this->app->register('responseType','json');
|
|
| 145 | + $this->app->register('instanceController', null);
|
|
| 146 | + $this->app->register('responseSuccess', true);
|
|
| 147 | + $this->app->register('responseStatus', 200);
|
|
| 148 | + $this->app->register('responseType', 'json');
|
|
| 149 | 149 | |
| 150 | 150 | //we first load the response class as a singleton object to allow you to send output anywhere |
| 151 | - $this->app->register('out',$this->app->resolve(ResponseProvider::class));
|
|
| 151 | + $this->app->register('out', $this->app->resolve(ResponseProvider::class));
|
|
| 152 | 152 | |
| 153 | 153 | $requestService = "Store\Services\RequestService"; |
| 154 | 154 | |
| 155 | 155 | //The HttpFoundation component defines an object-oriented layer for the HTTP specification. |
| 156 | 156 | //The HttpFoundation component replaces these default PHP global variables and functions by an object-oriented layer |
| 157 | - if(Utils::isNamespaceExists($requestService)){
|
|
| 157 | + if (Utils::isNamespaceExists($requestService)) {
|
|
| 158 | 158 | |
| 159 | 159 | Request::setFactory(function(array $query = array(), |
| 160 | 160 | array $request = array(), |
@@ -176,16 +176,16 @@ discard block |
||
| 176 | 176 | |
| 177 | 177 | |
| 178 | 178 | //After registering the symfony request method, we also save the get and post methods for user convenience. |
| 179 | - $this->app->register('request',Request::createFromGlobals());
|
|
| 180 | - $this->app->register('get',core()->request->query->all());
|
|
| 181 | - $this->app->register('post',core()->request->request->all());
|
|
| 179 | + $this->app->register('request', Request::createFromGlobals());
|
|
| 180 | + $this->app->register('get', core()->request->query->all());
|
|
| 181 | + $this->app->register('post', core()->request->request->all());
|
|
| 182 | 182 | |
| 183 | 183 | //We determine with the kernel object which HTTP method the requested from the client |
| 184 | - $this->app->register('httpMethod',ucfirst(strtolower(core()->request->getRealMethod())));
|
|
| 184 | + $this->app->register('httpMethod', ucfirst(strtolower(core()->request->getRealMethod())));
|
|
| 185 | 185 | |
| 186 | - define('httpMethod',strtoupper(core()->httpMethod));
|
|
| 186 | + define('httpMethod', strtoupper(core()->httpMethod));
|
|
| 187 | 187 | |
| 188 | - $this->app->register('fileSystem',new FileProcess());
|
|
| 188 | + $this->app->register('fileSystem', new FileProcess());
|
|
| 189 | 189 | } |
| 190 | 190 | |
| 191 | 191 | } |
| 192 | 192 | \ No newline at end of file |