Passed
Push โ€” master ( 0f9bce...241f41 )
by Php Easy Api
02:49
created
src/resta/Foundation/ApplicationHelpers.php 2 patches
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -183,8 +183,7 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
@@ -166,10 +166,10 @@  discard block
 block discarded – undo
166 166
      * @param array $params
167 167
      * @return ExceptionContracts
168 168
      */
169
-    function exception($name=null,$params=array())
169
+    function exception($name = null, $params = array())
170 170
     {
171
-        $exceptionManager=ExceptionManager::class;
172
-        return app()->resolve($exceptionManager,['name'=>$name,'params'=>$params]);
171
+        $exceptionManager = ExceptionManager::class;
172
+        return app()->resolve($exceptionManager, ['name'=>$name, 'params'=>$params]);
173 173
     }
174 174
 }
175 175
 
@@ -179,13 +179,13 @@  discard block
 block discarded – undo
179 179
      * @param null $locale
180 180
      * @return Generator
181 181
      */
182
-    function faker($locale=null)
182
+    function faker($locale = null)
183 183
     {
184
-        if($locale===null){
185
-            $faker=Factory::create();
184
+        if ($locale===null) {
185
+            $faker = Factory::create();
186 186
         }
187
-        else{
188
-            $faker=Factory::create($locale);
187
+        else {
188
+            $faker = Factory::create($locale);
189 189
         }
190 190
 
191 191
         return $faker;
@@ -196,8 +196,8 @@  discard block
 block discarded – undo
196 196
 
197 197
     function fingerPrint()
198 198
     {
199
-        return md5(sha1(implode("|",[
200
-            request()->getClientIp(),$_SERVER['HTTP_USER_AGENT'],applicationKey()
199
+        return md5(sha1(implode("|", [
200
+            request()->getClientIp(), $_SERVER['HTTP_USER_AGENT'], applicationKey()
201 201
         ])));
202 202
     }
203 203
 }
@@ -217,10 +217,10 @@  discard block
 block discarded – undo
217 217
      * @param null $default
218 218
      * @return null
219 219
      */
220
-    function get($param=null,$default=null)
220
+    function get($param = null, $default = null)
221 221
     {
222 222
         //symfony request query object
223
-        $get=core()->get;
223
+        $get = core()->get;
224 224
 
225 225
         return ($param===null) ? $get : (isset($get[$param]) ? $get[$param] : $default);
226 226
     }
@@ -233,14 +233,14 @@  discard block
 block discarded – undo
233 233
      * @param null $default
234 234
      * @return array
235 235
      */
236
-    function headers($param=null,$default=null)
236
+    function headers($param = null, $default = null)
237 237
     {
238
-        $list=[];
238
+        $list = [];
239 239
 
240 240
         //We only get the objects in the list name to match the header objects
241 241
         //that come with the request path to the objects sent by the client
242 242
         foreach (request()->headers->all() as $key=>$value) {
243
-            $list[$key]=$value;
243
+            $list[$key] = $value;
244 244
         }
245 245
 
246 246
         //return header list
@@ -265,9 +265,9 @@  discard block
 block discarded – undo
265 265
      * @param $file null
266 266
      * @return LoggerHandler
267 267
      */
268
-    function logger($file=null)
268
+    function logger($file = null)
269 269
     {
270
-        return app()->resolve(LoggerHandler::class,['file'=>$file]);
270
+        return app()->resolve(LoggerHandler::class, ['file'=>$file]);
271 271
     }
272 272
 }
273 273
 
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
      */
290 290
     function response()
291 291
     {
292
-        $object=debug_backtrace()[1]['object'];
292
+        $object = debug_backtrace()[1]['object'];
293 293
         return new ResponseOutManager($object);
294 294
     }
295 295
 }
@@ -304,9 +304,9 @@  discard block
 block discarded – undo
304 304
      * @throws \DI\DependencyException
305 305
      * @throws \DI\NotFoundException
306 306
      */
307
-    function resolve($class,$bind=array())
307
+    function resolve($class, $bind = array())
308 308
     {
309
-        return app()->resolve($class,$bind);
309
+        return app()->resolve($class, $bind);
310 310
     }
311 311
 }
312 312
 
@@ -316,9 +316,9 @@  discard block
 block discarded – undo
316 316
      * @param $key
317 317
      * @return mixed
318 318
      */
319
-    function route($key=null)
319
+    function route($key = null)
320 320
     {
321
-        return array_map(function($route){
321
+        return array_map(function($route) {
322 322
             return strtolower($route);
323 323
         },app()->singleton()->appClass->route($key));
324 324
     }
@@ -342,10 +342,10 @@  discard block
 block discarded – undo
342 342
      * @param null $default
343 343
      * @return mixed
344 344
      */
345
-    function post($param=null,$default=null)
345
+    function post($param = null, $default = null)
346 346
     {
347 347
         //symfony request query object
348
-        $post=core()->post;
348
+        $post = core()->post;
349 349
 
350 350
         return ($param===null) ? $post : (isset($post[$param]) ? $post[$param] : $default);
351 351
     }
@@ -376,8 +376,8 @@  discard block
 block discarded – undo
376 376
      * @param array $select
377 377
      * @return mixed
378 378
      */
379
-    function trans($lang,$select=array())
379
+    function trans($lang, $select = array())
380 380
     {
381
-        return app()->singleton()->appClass->translator($lang,$select);
381
+        return app()->singleton()->appClass->translator($lang, $select);
382 382
     }
383 383
 }
384 384
\ No newline at end of file
Please login to merge, or discard this patch.
src/resta/Foundation/Bootstrapper/BootFireCallback.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -18,12 +18,12 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
     /**
Please login to merge, or discard this patch.
src/resta/Foundation/ApplicationBaseRegister.php 3 patches
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -34,8 +34,7 @@
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
         $this->isAvailableStore();
63 63
 
64 64
         //global accessor handling
65
-       $this->setGlobalAccessor();
65
+        $this->setGlobalAccessor();
66 66
 
67 67
         // sets a user-defined error handler function
68 68
         // this function can be used for defining your own way of handling errors during runtime,
@@ -148,12 +148,12 @@  discard block
 block discarded – undo
148 148
         if(Utils::isNamespaceExists($requestService)){
149 149
 
150 150
             Request::setFactory(function(array $query = array(),
151
-                                         array $request = array(),
152
-                                         array $attributes = array(),
153
-                                         array $cookies = array(),
154
-                                         array $files = array(),
155
-                                         array $server = array(),
156
-                                         $content = null) use ($requestService)
151
+                                            array $request = array(),
152
+                                            array $attributes = array(),
153
+                                            array $cookies = array(),
154
+                                            array $files = array(),
155
+                                            array $server = array(),
156
+                                            $content = null) use ($requestService)
157 157
             {
158 158
                 return new $requestService($query,
159 159
                     $request,
Please login to merge, or discard this patch.
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -29,11 +29,11 @@  discard block
 block discarded – undo
29 29
         // if the store directory is available,
30 30
         // then the application process continues.
31 31
         // if not available, only the core is executed.
32
-        if(file_exists(app()->path()->storeDir())){
33
-            $this->app->register('isAvailableStore',true);
32
+        if (file_exists(app()->path()->storeDir())) {
33
+            $this->app->register('isAvailableStore', true);
34 34
         }
35
-        else{
36
-            $this->app->register('isAvailableStore',false);
35
+        else {
36
+            $this->app->register('isAvailableStore', false);
37 37
         }
38 38
     }
39 39
 
@@ -47,13 +47,13 @@  discard block
 block discarded – undo
47 47
     {
48 48
         //we can use this method to move an instance of the application class with the kernel object
49 49
         //and easily resolve an encrypted instance of all the kernel variables in our helper class.
50
-        ClassAliasGroup::setAlias(App::class,'application');
50
+        ClassAliasGroup::setAlias(App::class, 'application');
51 51
 
52 52
         //set base instances
53 53
         $this->setBaseInstances();
54 54
 
55 55
         //we define the general application instance object.
56
-        define('appInstance',(base64_encode(serialize($this->app))));
56
+        define('appInstance', (base64_encode(serialize($this->app))));
57 57
 
58 58
         //main loader for application
59 59
         $this->mainLoader();
@@ -68,8 +68,8 @@  discard block
 block discarded – undo
68 68
         // this function can be used for defining your own way of handling errors during runtime,
69 69
         // for example in applications in which you need to do cleanup of data/files when a critical error happens,
70 70
         // or when you need to trigger an error under certain conditions (using trigger_error()).
71
-        if($this->app['isAvailableStore']){
72
-            $this->app->make('exception',function(){
71
+        if ($this->app['isAvailableStore']) {
72
+            $this->app->make('exception', function() {
73 73
                 return ErrorProvider::class;
74 74
             });
75 75
         }
@@ -84,30 +84,30 @@  discard block
 block discarded – undo
84 84
     {
85 85
         // for revision records,
86 86
         // the master key is assigned as revision.
87
-        $this->app->register('revision',[]);
87
+        $this->app->register('revision', []);
88 88
 
89 89
         //we're saving the directory where kernel files are running to the kernel object.
90
-        $this->app->register('corePath',str_replace('Foundation','',__DIR__.''));
90
+        $this->app->register('corePath', str_replace('Foundation', '', __DIR__.''));
91 91
 
92 92
         //For the application, we create the object that the register method,
93 93
         // which is the container center, is connected to by the kernel object register method.
94
-        $this->app->register('container',$this->app);
94
+        $this->app->register('container', $this->app);
95 95
 
96 96
         // We are saving the application class to
97 97
         // the container object for the appClass value.
98
-        $this->app->register('appClass',new App());
98
+        $this->app->register('appClass', new App());
99 99
 
100 100
         //set closure bind instance for application
101
-        $this->app->register('appClosureInstance',ClosureDispatcher::bind(app()));
101
+        $this->app->register('appClosureInstance', ClosureDispatcher::bind(app()));
102 102
 
103 103
         //set closure bind instance for bootLoader class
104
-        $this->app->register('closureBootLoader',ClosureDispatcher::bind($this->app['bootLoader']));
104
+        $this->app->register('closureBootLoader', ClosureDispatcher::bind($this->app['bootLoader']));
105 105
 
106 106
         //set register for macro
107
-        $this->app->register('macro',$this->app->resolve(Macro::class));
107
+        $this->app->register('macro', $this->app->resolve(Macro::class));
108 108
 
109 109
         //set register for macro
110
-        $this->app->register('pipeline',new Pipeline());
110
+        $this->app->register('pipeline', new Pipeline());
111 111
 
112 112
     }
113 113
 
@@ -121,10 +121,10 @@  discard block
 block discarded – undo
121 121
         //register as instance application object
122 122
         // and container instance resolve
123 123
         //set core instance value
124
-        $this->app->instance('container',$this->app->singleton());
125
-        $this->app->instance('bootLoader',$this->app->resolve(BootLoader::class));
126
-        $this->app->instance('containerInstanceResolve',ContainerInstanceResolver::class);
127
-        $this->app->instance('reflection',ReflectionProcess::class);
124
+        $this->app->instance('container', $this->app->singleton());
125
+        $this->app->instance('bootLoader', $this->app->resolve(BootLoader::class));
126
+        $this->app->instance('containerInstanceResolve', ContainerInstanceResolver::class);
127
+        $this->app->instance('reflection', ReflectionProcess::class);
128 128
     }
129 129
 
130 130
     /**
@@ -133,19 +133,19 @@  discard block
 block discarded – undo
133 133
     private function setGlobalAccessor()
134 134
     {
135 135
         //get response success and status
136
-        $this->app->register('instanceController',null);
137
-        $this->app->register('responseSuccess',true);
138
-        $this->app->register('responseStatus',200);
139
-        $this->app->register('responseType','json');
136
+        $this->app->register('instanceController', null);
137
+        $this->app->register('responseSuccess', true);
138
+        $this->app->register('responseStatus', 200);
139
+        $this->app->register('responseType', 'json');
140 140
 
141 141
         //we first load the response class as a singleton object to allow you to send output anywhere
142
-        $this->app->register('out',$this->app->resolve(ResponseProvider::class));
142
+        $this->app->register('out', $this->app->resolve(ResponseProvider::class));
143 143
 
144 144
         $requestService = "Store\Services\RequestService";
145 145
 
146 146
         //The HttpFoundation component defines an object-oriented layer for the HTTP specification.
147 147
         //The HttpFoundation component replaces these default PHP global variables and functions by an object-oriented layer
148
-        if(Utils::isNamespaceExists($requestService)){
148
+        if (Utils::isNamespaceExists($requestService)) {
149 149
 
150 150
             Request::setFactory(function(array $query = array(),
151 151
                                          array $request = array(),
@@ -167,16 +167,16 @@  discard block
 block discarded – undo
167 167
 
168 168
 
169 169
         //After registering the symfony request method, we also save the get and post methods for user convenience.
170
-        $this->app->register('request',Request::createFromGlobals());
171
-        $this->app->register('get',core()->request->query->all());
172
-        $this->app->register('post',core()->request->request->all());
170
+        $this->app->register('request', Request::createFromGlobals());
171
+        $this->app->register('get', core()->request->query->all());
172
+        $this->app->register('post', core()->request->request->all());
173 173
 
174 174
         //We determine with the kernel object which HTTP method the requested from the client
175
-        $this->app->register('httpMethod',ucfirst(strtolower(core()->request->getRealMethod())));
175
+        $this->app->register('httpMethod', ucfirst(strtolower(core()->request->getRealMethod())));
176 176
 
177
-        define('httpMethod',strtoupper(core()->httpMethod));
177
+        define('httpMethod', strtoupper(core()->httpMethod));
178 178
 
179
-        $this->app->register('fileSystem',new FileProcess());
179
+        $this->app->register('fileSystem', new FileProcess());
180 180
     }
181 181
 
182 182
 }
183 183
\ No newline at end of file
Please login to merge, or discard this patch.
src/resta/Container/ContainerKernelAssigner.php 2 patches
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -117,8 +117,7 @@
 block discarded – undo
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.
Please login to merge, or discard this patch.
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -12,12 +12,12 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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.
Please login to merge, or discard this patch.
src/resta/Container/ContainerResolve.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -18,21 +18,21 @@  discard block
 block discarded – undo
18 18
      *
19 19
      * @throws \ReflectionException
20 20
      */
21
-    public function call($class,$param,callable $callback)
21
+    public function call($class, $param, callable $callback)
22 22
     {
23 23
         // We use the reflection class to solve
24 24
         // the parameters of the class's methods.
25
-        $param = $this->reflectionMethodParameters($class,$param);
25
+        $param = $this->reflectionMethodParameters($class, $param);
26 26
 
27 27
         // the results of a number of processes will be given
28 28
         // before the container pipeline method is given.
29 29
         return $this->app->resolve(ContainerPipelineResolve::class)->handle(
30
-            function() use($class,$param,$callback)
30
+            function() use($class, $param, $callback)
31 31
             {
32 32
                 // as a result
33 33
                 // we return the resolved class to the callback class
34
-                $params = (object)['class'=>$class,'param'=>$param];
35
-                return call_user_func_array($callback,[$params]);
34
+                $params = (object)['class'=>$class, 'param'=>$param];
35
+                return call_user_func_array($callback, [$params]);
36 36
             });
37 37
 
38 38
     }
@@ -44,12 +44,12 @@  discard block
 block discarded – undo
44 44
      * @param $parameter
45 45
      * @return array
46 46
      */
47
-    private function checkParameterForContainer($containers,$parameter)
47
+    private function checkParameterForContainer($containers, $parameter)
48 48
     {
49 49
         // if the parameter is an object and
50 50
         // this object is a service container object
51 51
         // then the parameter will bind.
52
-        if($parameter->getType()!==null && isset($containers[$parameter->getType()->getName()])){
52
+        if ($parameter->getType()!==null && isset($containers[$parameter->getType()->getName()])) {
53 53
 
54 54
             // Unpack the container object and
55 55
             // bind it to the param variable.
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
             return [$parameterName=>$parameterResolve];
69 69
         }
70 70
 
71
-        if($parameter->getType()!== NULL && Utils::isNamespaceExists($parameter->getType()->getName())){
71
+        if ($parameter->getType()!==NULL && Utils::isNamespaceExists($parameter->getType()->getName())) {
72 72
 
73 73
             // Unpack the container object and
74 74
             // bind it to the param variable.
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
      */
92 92
     private function getReflectionMethod($class)
93 93
     {
94
-        [$class,$method] = [$class[0],$class[1]];
94
+        [$class, $method] = [$class[0], $class[1]];
95 95
 
96 96
         return $this->app['reflection']($class)->reflectionMethodParams($method);
97 97
     }
@@ -105,12 +105,12 @@  discard block
 block discarded – undo
105 105
      *
106 106
      * @throws \ReflectionException
107 107
      */
108
-    private function reflectionMethodParameters($class,$param)
108
+    private function reflectionMethodParameters($class, $param)
109 109
     {
110 110
         $containers = [];
111 111
 
112 112
         //get service container objects.
113
-        if(isset($this->app['serviceContainer'])){
113
+        if (isset($this->app['serviceContainer'])) {
114 114
             $containers = $this->app['serviceContainer'];
115 115
         }
116 116
 
@@ -122,22 +122,22 @@  discard block
 block discarded – undo
122 122
         // we provide the user with the container method document and take action.
123 123
         // thus, we help the methods to have a cleaner code structure.
124 124
         $this->app->resolve(ContainerMethodDocumentResolver::class,
125
-            ['document'=>$reflection->document,'class'=>$class]);
125
+            ['document'=>$reflection->document, 'class'=>$class]);
126 126
 
127 127
         // we group the parameters into type and
128 128
         // name and bind them with the necessary logic.
129
-        foreach ($parameters as $parameter){
129
+        foreach ($parameters as $parameter) {
130 130
 
131 131
             // if the parameter is an object and
132 132
             // this object is a service container object
133 133
             // then the parameter will bind.
134
-            $checkParameterForContainer = $this->checkParameterForContainer($containers,$parameter);
135
-            $paramMerge = array_merge($param,$checkParameterForContainer);
134
+            $checkParameterForContainer = $this->checkParameterForContainer($containers, $parameter);
135
+            $paramMerge = array_merge($param, $checkParameterForContainer);
136 136
 
137 137
             // we do some useful logic bind for user benefit.
138
-            $param = app()->resolve(GraceContainer::class,[
138
+            $param = app()->resolve(GraceContainer::class, [
139 139
                 'reflection' => $reflection->reflection
140
-            ])->graceContainerBuilder($parameter,$paramMerge);
140
+            ])->graceContainerBuilder($parameter, $paramMerge);
141 141
 
142 142
         }
143 143
 
Please login to merge, or discard this patch.
src/resta/Container/GraceContainer.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
     /**
12 12
      * @var array $nameContainers
13 13
      */
14
-    protected $nameContainers=[
14
+    protected $nameContainers = [
15 15
         'route'=>Route::class
16 16
     ];
17 17
 
@@ -44,24 +44,24 @@  discard block
 block discarded – undo
44 44
      * @param $param
45 45
      * @return array
46 46
      */
47
-    protected function getNameContainers($parameter,$param)
47
+    protected function getNameContainers($parameter, $param)
48 48
     {
49 49
         // If the parameter contains a route variable.
50 50
         // We do a custom bind for the route
51
-        if($this->checkNameContainer($parameter)){
51
+        if ($this->checkNameContainer($parameter)) {
52 52
 
53 53
             // we do the name control for the container here,
54 54
             // and if we have the name container we are checking, we make a handle make bind.
55
-            $nameContainers=$this->nameContainers[$parameter->getName()];
56
-            return app()->resolve($nameContainers,[
55
+            $nameContainers = $this->nameContainers[$parameter->getName()];
56
+            return app()->resolve($nameContainers, [
57 57
                 'reflection' => $this->reflection
58
-            ])->resolveContainer($parameter->getDefaultValue(),$param);
58
+            ])->resolveContainer($parameter->getDefaultValue(), $param);
59 59
         }
60 60
 
61 61
         // In particular, name container values can be specified and
62 62
         // they are injected directly into the methods contextually.
63
-        if(isset(core()->serviceContainer[$parameter->getName()])){
64
-            return app()->resolve(SpecialNameContainer::class)->resolveContainer($parameter,$param);
63
+        if (isset(core()->serviceContainer[$parameter->getName()])) {
64
+            return app()->resolve(SpecialNameContainer::class)->resolveContainer($parameter, $param);
65 65
 
66 66
         }
67 67
 
@@ -73,17 +73,17 @@  discard block
 block discarded – undo
73 73
      * @param $param
74 74
      * @return mixed
75 75
      */
76
-    public function graceContainerBuilder($parameter,$param)
76
+    public function graceContainerBuilder($parameter, $param)
77 77
     {
78 78
         // if the parameter is an object
79 79
         // but not a container object.
80 80
         // we do some useful logic bind for user benefit.
81
-        if($parameter->getType()!==null){
82
-            return app()->resolve(RepositoryContainer::class)->handle($parameter,$param);
81
+        if ($parameter->getType()!==null) {
82
+            return app()->resolve(RepositoryContainer::class)->handle($parameter, $param);
83 83
         }
84 84
 
85 85
         // In particular, name container values can be specified and
86 86
         // they are injected directly into the methods contextually.
87
-        return $this->getNameContainers($parameter,$param);
87
+        return $this->getNameContainers($parameter, $param);
88 88
     }
89 89
 }
90 90
\ No newline at end of file
Please login to merge, or discard this patch.
src/resta/Container/Container.php 2 patches
Spacing   +58 added lines, -58 removed lines patch added patch discarded remove patch
@@ -7,12 +7,12 @@  discard block
 block discarded – undo
7 7
 use Resta\Contracts\ContainerContracts;
8 8
 use Resta\Container\ContainerKernelAssigner;
9 9
 
10
-class Container implements ContainerContracts,\ArrayAccess
10
+class Container implements ContainerContracts, \ArrayAccess
11 11
 {
12 12
     /**
13 13
      * @var $singleton
14 14
      */
15
-    public $singleton=false;
15
+    public $singleton = false;
16 16
 
17 17
     /**
18 18
      * @var $kernel
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
     /**
23 23
      * @var array  $instance
24 24
      */
25
-    private static $instance=[];
25
+    private static $instance = [];
26 26
 
27 27
     /**
28 28
      * @var array $instances
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
     /**
33 33
      * @var array $bindParams
34 34
      */
35
-    private static $bindParams=[];
35
+    private static $bindParams = [];
36 36
 
37 37
     /**
38 38
      * @var $unregister
@@ -42,19 +42,19 @@  discard block
 block discarded – undo
42 42
     /**
43 43
      * @var array
44 44
      */
45
-    protected $values=[];
45
+    protected $values = [];
46 46
 
47 47
     /**
48 48
      * @param $make
49 49
      * @param array $bind
50 50
      * @return array
51 51
      */
52
-    public function applicationProviderBinding($make,$bind=array())
52
+    public function applicationProviderBinding($make, $bind = array())
53 53
     {
54 54
         //service container is an automatic application provider
55 55
         //that we can bind to the special class di in the dependency condition.
56 56
         //This method is automatically added to the classes resolved by the entire make bind method.
57
-        return array_merge($bind,['app'=>$make]);
57
+        return array_merge($bind, ['app'=>$make]);
58 58
     }
59 59
 
60 60
     /**
@@ -65,12 +65,12 @@  discard block
 block discarded – undo
65 65
      * @throws \DI\DependencyException
66 66
      * @throws \DI\NotFoundException
67 67
      */
68
-    public function bind($object=null,$callback=null)
68
+    public function bind($object = null, $callback = null)
69 69
     {
70 70
         //If the bind method does not have parameters object and callback, the value is directly assigned to the kernel object.
71 71
         //Otherwise, when the bind object and callback are sent, the closure class inherits
72 72
         //the applicationProvider object and the resolve method is called
73
-        return $this->make($object,$callback,'container');
73
+        return $this->make($object, $callback, 'container');
74 74
     }
75 75
 
76 76
     /**
@@ -82,16 +82,16 @@  discard block
 block discarded – undo
82 82
      * @throws \DI\DependencyException
83 83
      * @throws \DI\NotFoundException
84 84
      */
85
-    private function build($object,$callback,$sync=false)
85
+    private function build($object, $callback, $sync = false)
86 86
     {
87 87
         //If the console object returns true,
88 88
         //we do not cancel binding operations
89 89
         //We are getting what applies to console with consoleKernelObject.
90
-        if($sync===false) return $this->consoleKernelObjectChecker($object,$callback);
90
+        if ($sync===false) return $this->consoleKernelObjectChecker($object, $callback);
91 91
 
92 92
         //the value corresponding to the bind value for the global object is assigned and
93 93
         //the resolve method is called for the dependency injection.
94
-        $this->kernelAssigner()->setKernelObject($object,$callback);
94
+        $this->kernelAssigner()->setKernelObject($object, $callback);
95 95
 
96 96
         //return kernel object
97 97
         return $this->kernel();
@@ -106,11 +106,11 @@  discard block
 block discarded – undo
106 106
      * @throws \DI\DependencyException
107 107
      * @throws \DI\NotFoundException
108 108
      */
109
-    private function consoleKernelObject($object,$callback,$container=false)
109
+    private function consoleKernelObject($object, $callback, $container = false)
110 110
     {
111 111
         //we use the console bindings class to specify the classes to be preloaded in the console application.
112 112
         //Thus, classes that can not be bound with http are called without closure in global loaders directory.
113
-        $this->resolve(ConsoleBindings::class)->console($object,$callback,$container);
113
+        $this->resolve(ConsoleBindings::class)->console($object, $callback, $container);
114 114
 
115 115
         //The console application must always return the kernel method.
116 116
         return $this->kernel();
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
      * @throws \DI\DependencyException
126 126
      * @throws \DI\NotFoundException
127 127
      */
128
-    private function consoleKernelObjectChecker($object,$callback,$container=false)
128
+    private function consoleKernelObjectChecker($object, $callback, $container = false)
129 129
     {
130 130
         //we check whether the callback value is a callable function.
131 131
         $isCallableForCallback = is_callable($callback);
@@ -133,10 +133,10 @@  discard block
 block discarded – undo
133 133
         //If the console object returns true,
134 134
         //we do not cancel binding operations
135 135
         //We are getting what applies to console with consoleKernelObject.
136
-        if($this->console() AND $isCallableForCallback) return $this->consoleKernelObject($object,$callback,$container);
136
+        if ($this->console() AND $isCallableForCallback) return $this->consoleKernelObject($object, $callback, $container);
137 137
 
138 138
         //If the application is not a console operation, we re-bind to existing methods synchronously.
139
-        return ($container) ? $this->containerBuild($object,$callback,true) : $this->build($object,$callback,true);
139
+        return ($container) ? $this->containerBuild($object, $callback, true) : $this->build($object, $callback, true);
140 140
     }
141 141
 
142 142
     /**
@@ -146,11 +146,11 @@  discard block
 block discarded – undo
146 146
      * @throws \DI\DependencyException
147 147
      * @throws \DI\NotFoundException
148 148
      */
149
-    private function consoleShared($object,$callback)
149
+    private function consoleShared($object, $callback)
150 150
     {
151 151
         //The console share is evaluated as a true variable to be assigned as the 3rd parameter in the classes to be bound.
152 152
         //The work to be done here is to bind the classes to be included in the console share privately.
153
-        $this->kernelAssigner()->consoleShared($object,$callback);
153
+        $this->kernelAssigner()->consoleShared($object, $callback);
154 154
     }
155 155
 
156 156
     /**
@@ -162,12 +162,12 @@  discard block
 block discarded – undo
162 162
      * @throws \DI\DependencyException
163 163
      * @throws \DI\NotFoundException
164 164
      */
165
-    public function containerBuild($object,$callback,$sync=false)
165
+    public function containerBuild($object, $callback, $sync = false)
166 166
     {
167 167
         //If the console object returns true,
168 168
         //we do not cancel binding operations
169 169
         //We are getting what applies to console with consoleKernelObject.
170
-        if($sync===false) return $this->consoleKernelObjectChecker($object,$callback,true);
170
+        if ($sync===false) return $this->consoleKernelObjectChecker($object, $callback, true);
171 171
 
172 172
         //Since the objects that come to the build method are objects from the container method,
173 173
         //we need to automatically create a kernel object named serviceContainer in this method.
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
 
176 176
         //the value corresponding to the bind value for the global object is assigned and
177 177
         //the resolve method is called for the dependency method.
178
-        $this->kernelAssigner()->setKernelObject($object,$callback,'serviceContainer');
178
+        $this->kernelAssigner()->setKernelObject($object, $callback, 'serviceContainer');
179 179
 
180 180
         //return kernel object
181 181
         return $this->kernel();
@@ -185,11 +185,11 @@  discard block
 block discarded – undo
185 185
      * @param $class
186 186
      * @param $bind
187 187
      */
188
-    private function contextualBindCleaner($class,$bind)
188
+    private function contextualBindCleaner($class, $bind)
189 189
     {
190 190
         //the context bind objects are checked again and the bind sequence submitted by
191 191
         //the user is checked and forced to re-instantiate the object.
192
-        if(isset(self::$instance[$class]) && self::$bindParams[$class]!==$bind){
192
+        if (isset(self::$instance[$class]) && self::$bindParams[$class]!==$bind) {
193 193
             unset(self::$instance[$class]);
194 194
             unset(self::$bindParams[$class]);
195 195
         }
@@ -208,11 +208,11 @@  discard block
 block discarded – undo
208 208
 
209 209
         // the has method can have a dotted string value so
210 210
         // we need to be able to control the string or array within the container.
211
-        foreach (explode(".",$abstract) as $item){
212
-            if(isset($container[$item])){
211
+        foreach (explode(".", $abstract) as $item) {
212
+            if (isset($container[$item])) {
213 213
                 $container = $container[$item];
214 214
             }
215
-            else{
215
+            else {
216 216
                 return null;
217 217
             }
218 218
         }
@@ -235,11 +235,11 @@  discard block
 block discarded – undo
235 235
 
236 236
         // the has method can have a dotted string value so
237 237
         // we need to be able to control the string or array within the container.
238
-        foreach (explode(".",$abstract) as $item){
238
+        foreach (explode(".", $abstract) as $item) {
239 239
 
240 240
             // this blog will work
241 241
             // if the data in the container loop points to an array.
242
-            if(!is_array($container)){
242
+            if (!is_array($container)) {
243 243
 
244 244
                 // we are querying the value of
245 245
                 // the items corresponding to the dotted value in the container.
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
                 $container = $container[$item];
248 248
                 $bools[] = is_null($container) ? false : true;
249 249
             }
250
-            else{
250
+            else {
251 251
 
252 252
                 // if the container array corresponds to a string,
253 253
                 // the bools array is filled with the isset control directly.
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
 
258 258
         // the method returns false if the bools sequence is false,
259 259
         // otherwise it will return true.
260
-        return in_array(false,$bools) ? false : true;
260
+        return in_array(false, $bools) ? false : true;
261 261
     }
262 262
 
263 263
     /**
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
      * @throws \DI\DependencyException
308 308
      * @throws \DI\NotFoundException
309 309
      */
310
-    public function make($object=null,$callback=null,$container=false)
310
+    public function make($object = null, $callback = null, $container = false)
311 311
     {
312 312
         //we check whether the boolean value of the singleton variable used
313 313
         //for booting does not reset every time the object variable to be assigned to the kernel variable is true
@@ -315,8 +315,8 @@  discard block
 block discarded – undo
315 315
 
316 316
         //The console share is evaluated as a true variable to be assigned as the 3rd parameter in the classes to be bound.
317 317
         //The work to be done here is to bind the classes to be included in the console share privately.
318
-        if($container){
319
-            $this->consoleShared($object,$callback);
318
+        if ($container) {
319
+            $this->consoleShared($object, $callback);
320 320
         }
321 321
 
322 322
         //If the third parameter passed to the bind method carries a container value,
@@ -326,7 +326,7 @@  discard block
 block discarded – undo
326 326
         //If the bind method does not have parameters object and callback, the value is directly assigned to the kernel object.
327 327
         //Otherwise, when the bind object and callback are sent, the closure class inherits
328 328
         //the applicationProvider object and the resolve method is called
329
-        return ($object===null) ? $this->kernel() : $this->{$makeBuild}($object,$callback);
329
+        return ($object===null) ? $this->kernel() : $this->{$makeBuild}($object, $callback);
330 330
     }
331 331
 
332 332
     /**
@@ -343,7 +343,7 @@  discard block
 block discarded – undo
343 343
      */
344 344
     public function offsetGet($offset) {
345 345
 
346
-        return $this->resolve($this->instances['containerInstanceResolve'],[
346
+        return $this->resolve($this->instances['containerInstanceResolve'], [
347 347
             'instances' => $this->instances
348 348
         ])->{$offset}();
349 349
     }
@@ -367,7 +367,7 @@  discard block
 block discarded – undo
367 367
      * @param null $concrete
368 368
      * @return bool|mixed
369 369
      */
370
-    public function register($key,$object,$concrete=null)
370
+    public function register($key, $object, $concrete = null)
371 371
     {
372 372
         // we assign the values โ€‹โ€‹required
373 373
         // for register to the global value variable.
@@ -377,7 +377,7 @@  discard block
 block discarded – undo
377 377
 
378 378
         // If there is an instance of the application class,
379 379
         // the register method is saved both in this example and in the global.
380
-        if(defined('appInstance')){
380
+        if (defined('appInstance')) {
381 381
 
382 382
             // where we will assign both the global instance
383 383
             // and the registered application object.
@@ -396,19 +396,19 @@  discard block
 block discarded – undo
396 396
      * @param bool $withConcrete
397 397
      * @return bool
398 398
      */
399
-    private function registerProcess($instance,$withConcrete=false)
399
+    private function registerProcess($instance, $withConcrete = false)
400 400
     {
401 401
         // values recorded without concrete.
402 402
         // or values deleted
403
-        if(false===$withConcrete){
403
+        if (false===$withConcrete) {
404 404
 
405 405
             //values registered without concrete
406
-            $instance->{$this->values['key']}=$this->values['object'];
406
+            $instance->{$this->values['key']} = $this->values['object'];
407 407
             return false;
408 408
         }
409 409
 
410 410
         //values registered with concrete
411
-        $instance->{$this->values['key']}[$this->values['object']]=$this->values['concrete'];
411
+        $instance->{$this->values['key']}[$this->values['object']] = $this->values['concrete'];
412 412
     }
413 413
 
414 414
     /**
@@ -419,22 +419,22 @@  discard block
 block discarded – undo
419 419
      * @throws \DI\DependencyException
420 420
      * @throws \DI\NotFoundException
421 421
      */
422
-    public function resolve($class,$bind=array())
422
+    public function resolve($class, $bind = array())
423 423
     {
424 424
         //the context bind objects are checked again and the bind sequence submitted by
425 425
         //the user is checked and forced to re-instantiate the object.
426
-        $this->contextualBindCleaner($class,$bind);
426
+        $this->contextualBindCleaner($class, $bind);
427 427
 
428 428
         //We do an instance check to get the static instance values of
429 429
         //the classes to be resolved with the make bind method.
430
-        if(!isset(self::$instance[$class])){
430
+        if (!isset(self::$instance[$class])) {
431 431
 
432 432
             //bind params object
433
-            self::$bindParams[$class]=$bind;
433
+            self::$bindParams[$class] = $bind;
434 434
 
435 435
             //By singleton checking, we solve the dependency injection of the given class.
436 436
             //Thus, each class can be called together with its dependency.
437
-            self::$instance[$class] = DIContainerManager::make($class,$this->applicationProviderBinding($this,self::$bindParams[$class]));
437
+            self::$instance[$class] = DIContainerManager::make($class, $this->applicationProviderBinding($this, self::$bindParams[$class]));
438 438
             $this->singleton()->resolved[$class] = self::$instance[$class];
439 439
 
440 440
             //return resolve class
@@ -452,9 +452,9 @@  discard block
 block discarded – undo
452 452
      * @param $class
453 453
      * @return mixed
454 454
      */
455
-    public function resolved($class){
455
+    public function resolved($class) {
456 456
 
457
-        if(isset($this['resolved'][$class])){
457
+        if (isset($this['resolved'][$class])) {
458 458
             return $this['resolved'][$class];
459 459
         }
460 460
 
@@ -469,7 +469,7 @@  discard block
 block discarded – undo
469 469
      * @throws \DI\DependencyException
470 470
      * @throws \DI\NotFoundException
471 471
      */
472
-    public function share($object=null,$callback=null)
472
+    public function share($object = null, $callback = null)
473 473
     {
474 474
         //we check whether the boolean value of the singleton variable used
475 475
         //for booting does not reset every time the object variable to be assigned to the kernel variable is true
@@ -477,12 +477,12 @@  discard block
 block discarded – undo
477 477
 
478 478
         //The console share is evaluated as a true variable to be assigned as the 3rd parameter in the classes to be bound.
479 479
         //The work to be done here is to bind the classes to be included in the console share privately.
480
-        $this->consoleShared($object,$callback);
480
+        $this->consoleShared($object, $callback);
481 481
 
482 482
         //If the bind method does not have parameters object and callback, the value is directly assigned to the kernel object.
483 483
         //Otherwise, when the bind object and callback are sent, the closure class inherits
484 484
         //the applicationProvider object and the resolve method is called
485
-        return ($object===null) ? $this->kernel() : $this->build($object,$callback);
485
+        return ($object===null) ? $this->kernel() : $this->build($object, $callback);
486 486
 
487 487
     }
488 488
 
@@ -502,7 +502,7 @@  discard block
 block discarded – undo
502 502
      */
503 503
     public function singleton()
504 504
     {
505
-        if($this->singleton===false){
505
+        if ($this->singleton===false) {
506 506
 
507 507
             //after first initializing, the singleton variable is set to true,
508 508
             //and subsequent incoming classes can inherit the loaded object.
@@ -523,12 +523,12 @@  discard block
 block discarded – undo
523 523
         // for application instance
524 524
         // if the values โ€‹โ€‹to be saved are to be saved without the concrete,
525 525
         // if it is an array.
526
-        if($this->values['concrete']===null) {
526
+        if ($this->values['concrete']===null) {
527 527
 
528 528
             // Without concrete,
529 529
             // the saved value will be saved
530 530
             // if the it does not exist in application instance.
531
-            if(!isset($instance->{$this->values['key']})) {
531
+            if (!isset($instance->{$this->values['key']})) {
532 532
                 $this->registerProcess($instance);
533 533
             }
534 534
             return false;
@@ -536,7 +536,7 @@  discard block
 block discarded – undo
536 536
 
537 537
         // We send concrete values to be recorded with concrete as true.
538 538
         // these values will be recorded as a array.
539
-        $this->registerProcess($instance,true);
539
+        $this->registerProcess($instance, true);
540 540
     }
541 541
 
542 542
     /**
@@ -545,11 +545,11 @@  discard block
 block discarded – undo
545 545
      * @param null $object
546 546
      * @return mixed
547 547
      */
548
-    public function terminate($key,$object=null)
548
+    public function terminate($key, $object = null)
549 549
     {
550 550
         // object null is
551 551
         // sent to just terminate a key.
552
-        if($object===null){
552
+        if ($object===null) {
553 553
             unset(core()->{$key});
554 554
             return false;
555 555
         }
Please login to merge, or discard this patch.
Braces   +11 added lines, -7 removed lines patch added patch discarded remove patch
@@ -87,7 +87,9 @@  discard block
 block discarded – undo
87 87
         //If the console object returns true,
88 88
         //we do not cancel binding operations
89 89
         //We are getting what applies to console with consoleKernelObject.
90
-        if($sync===false) return $this->consoleKernelObjectChecker($object,$callback);
90
+        if($sync===false) {
91
+            return $this->consoleKernelObjectChecker($object,$callback);
92
+        }
91 93
 
92 94
         //the value corresponding to the bind value for the global object is assigned and
93 95
         //the resolve method is called for the dependency injection.
@@ -133,7 +135,9 @@  discard block
 block discarded – undo
133 135
         //If the console object returns true,
134 136
         //we do not cancel binding operations
135 137
         //We are getting what applies to console with consoleKernelObject.
136
-        if($this->console() AND $isCallableForCallback) return $this->consoleKernelObject($object,$callback,$container);
138
+        if($this->console() AND $isCallableForCallback) {
139
+            return $this->consoleKernelObject($object,$callback,$container);
140
+        }
137 141
 
138 142
         //If the application is not a console operation, we re-bind to existing methods synchronously.
139 143
         return ($container) ? $this->containerBuild($object,$callback,true) : $this->build($object,$callback,true);
@@ -167,7 +171,9 @@  discard block
 block discarded – undo
167 171
         //If the console object returns true,
168 172
         //we do not cancel binding operations
169 173
         //We are getting what applies to console with consoleKernelObject.
170
-        if($sync===false) return $this->consoleKernelObjectChecker($object,$callback,true);
174
+        if($sync===false) {
175
+            return $this->consoleKernelObjectChecker($object,$callback,true);
176
+        }
171 177
 
172 178
         //Since the objects that come to the build method are objects from the container method,
173 179
         //we need to automatically create a kernel object named serviceContainer in this method.
@@ -211,8 +217,7 @@  discard block
 block discarded – undo
211 217
         foreach (explode(".",$abstract) as $item){
212 218
             if(isset($container[$item])){
213 219
                 $container = $container[$item];
214
-            }
215
-            else{
220
+            } else{
216 221
                 return null;
217 222
             }
218 223
         }
@@ -246,8 +251,7 @@  discard block
 block discarded – undo
246 251
                 // the control result is transferred to the bools array.
247 252
                 $container = $container[$item];
248 253
                 $bools[] = is_null($container) ? false : true;
249
-            }
250
-            else{
254
+            } else{
251 255
 
252 256
                 // if the container array corresponds to a string,
253 257
                 // the bools array is filled with the isset control directly.
Please login to merge, or discard this patch.
src/resta/Container/NameContainers/SpecialNameContainer.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -9,28 +9,28 @@  discard block
 block discarded – undo
9 9
      * @param $param
10 10
      * @return mixed
11 11
      */
12
-    public function resolveContainer($parameter,$param)
12
+    public function resolveContainer($parameter, $param)
13 13
     {
14 14
         //we get the custom name container value via serviceContainer.
15
-        $specialNameContainer=app()->singleton()->serviceContainer[$parameter->getName()];
15
+        $specialNameContainer = app()->singleton()->serviceContainer[$parameter->getName()];
16 16
 
17 17
         // we determine whether the value of
18 18
         // the private name container is class.
19
-        if(class_exists($specialNameContainer)){
19
+        if (class_exists($specialNameContainer)) {
20 20
 
21 21
             //we resolve the custom name container through the service container.
22
-            $resolveSpecialNameContainer=app()->resolve($specialNameContainer);
22
+            $resolveSpecialNameContainer = app()->resolve($specialNameContainer);
23 23
 
24 24
             // we need to find out whether we have
25 25
             // the specific name getNameContainer method solved
26 26
             // so we can use the special name container value with bind.
27
-            if(method_exists($resolveSpecialNameContainer,'getNameContainer')){
27
+            if (method_exists($resolveSpecialNameContainer, 'getNameContainer')) {
28 28
 
29 29
                 // when we bind the name container method,
30 30
                 // we check the existence of the default value so that we can use it directly for lean.
31 31
                 // and then save it in the parameter context by executing the getNameContainer method.
32
-                $getParams=($parameter->isDefaultValueAvailable()) ? $parameter->getDefaultValue() : null;
33
-                $param[$parameter->getName()]=$resolveSpecialNameContainer->getNameContainer($getParams);
32
+                $getParams = ($parameter->isDefaultValueAvailable()) ? $parameter->getDefaultValue() : null;
33
+                $param[$parameter->getName()] = $resolveSpecialNameContainer->getNameContainer($getParams);
34 34
 
35 35
                 //return $param
36 36
                 return $param;
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
         }
39 39
 
40 40
         //parameter context for special name container and return
41
-        $param[$parameter->getName()]=$parameter->getDefaultValue();
41
+        $param[$parameter->getName()] = $parameter->getDefaultValue();
42 42
         return $param;
43 43
     }
44 44
 
Please login to merge, or discard this patch.
src/resta/Container/NameContainers/RouteContainer.php 3 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -66,12 +66,12 @@
 block discarded – undo
66 66
         $list = [];
67 67
 
68 68
         if(preg_match('@route\((.*?)\)\r\n@is',$doc,$route)){
69
-           $routeParams = explode (" ",$route[1]);
69
+            $routeParams = explode (" ",$route[1]);
70 70
 
71
-           foreach ($routeParams as $routeParam){
72
-               $routeParam = explode(":",$routeParam);
73
-               $list[$routeParam[0]] = $routeParam[1];
74
-           }
71
+            foreach ($routeParams as $routeParam){
72
+                $routeParam = explode(":",$routeParam);
73
+                $list[$routeParam[0]] = $routeParam[1];
74
+            }
75 75
         }
76 76
 
77 77
         return $list;
Please login to merge, or discard this patch.
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
     /**
11 11
      * @var array $parameters
12 12
      */
13
-    protected $parameters=array();
13
+    protected $parameters = array();
14 14
 
15 15
     /**
16 16
      * @var $reflection \ReflectionMethod
@@ -32,12 +32,12 @@  discard block
 block discarded – undo
32 32
     private function checkRouteObligation($parameters)
33 33
     {
34 34
         //check $parameters value for obligation
35
-        foreach ($parameters as $parameterKey=>$parameter){
35
+        foreach ($parameters as $parameterKey=>$parameter) {
36 36
 
37 37
             // we use a question mark as a constant value which is not a necessity.
38 38
             // according to the presence of this sign,
39 39
             // we take this mark as a parameter to save the value as a real value.
40
-            $this->parameters[] = Str::replaceArray('?',[''],$parameter);
40
+            $this->parameters[] = Str::replaceArray('?', [''], $parameter);
41 41
 
42 42
             // we take all the route values
43 43
             // โ€‹โ€‹into the allRoutes variable.
@@ -45,11 +45,11 @@  discard block
 block discarded – undo
45 45
 
46 46
             // the values โ€‹โ€‹that do not end with the question mark
47 47
             // as mandatory values โ€‹โ€‹will be required as parameters.
48
-            if(!Str::endsWith($parameter,'?')){
48
+            if (!Str::endsWith($parameter, '?')) {
49 49
 
50 50
                 // if the requirement is not in the true route value,
51 51
                 // the exception will be thrown with the missing parameter message.
52
-                if(!isset($allRoutes[$parameterKey])){
52
+                if (!isset($allRoutes[$parameterKey])) {
53 53
                     exception()->invalidArgument('Route parameter is missing [ as '.$parameterKey.' key ]');
54 54
                 }
55 55
             }
@@ -65,11 +65,11 @@  discard block
 block discarded – undo
65 65
 
66 66
         $list = [];
67 67
 
68
-        if(preg_match('@route\((.*?)\)\r\n@is',$doc,$route)){
69
-           $routeParams = explode (" ",$route[1]);
68
+        if (preg_match('@route\((.*?)\)\r\n@is', $doc, $route)) {
69
+           $routeParams = explode(" ", $route[1]);
70 70
 
71
-           foreach ($routeParams as $routeParam){
72
-               $routeParam = explode(":",$routeParam);
71
+           foreach ($routeParams as $routeParam) {
72
+               $routeParam = explode(":", $routeParam);
73 73
                $list[$routeParam[0]] = $routeParam[1];
74 74
            }
75 75
         }
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
      * @param $param
83 83
      * @return mixed
84 84
      */
85
-    public function resolveContainer($parameters,$param)
85
+    public function resolveContainer($parameters, $param)
86 86
     {
87 87
         // we apply this method to obtain reliable
88 88
         // route data by checking the route requirement.
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
         // the user will determine
103 103
         // if the route parameters are in
104 104
         // accordance with the regular expression rule as a pattern.
105
-        $this->routePatternProcess($serviceConf,$param['route']);
105
+        $this->routePatternProcess($serviceConf, $param['route']);
106 106
 
107 107
         // when the route nameContainer is defined,
108 108
         // these keys must be absolute string data.
@@ -116,34 +116,34 @@  discard block
 block discarded – undo
116 116
      * @param $serviceConf
117 117
      * @param $params
118 118
      */
119
-    private function routePatternProcess($serviceConf,$params)
119
+    private function routePatternProcess($serviceConf, $params)
120 120
     {
121
-        if(isset($serviceConf['routeParameters'])){
121
+        if (isset($serviceConf['routeParameters'])) {
122 122
 
123 123
             $routeParameters = $serviceConf['routeParameters'];
124 124
 
125 125
             $pattern = [];
126 126
 
127
-            if(isset($routeParameters[strtolower(httpMethod)][methodName]['pattern'])){
127
+            if (isset($routeParameters[strtolower(httpMethod)][methodName]['pattern'])) {
128 128
                 $pattern = $routeParameters[strtolower(httpMethod)][methodName]['pattern'];
129 129
             }
130 130
 
131
-            foreach ($params as $key=>$param){
131
+            foreach ($params as $key=>$param) {
132 132
 
133 133
                 $routeFromDocComment = $this->getRouteFromDocComment();
134 134
 
135
-                if(isset($routeFromDocComment[$key])){
135
+                if (isset($routeFromDocComment[$key])) {
136 136
 
137
-                    if(!preg_match('@^'.$routeFromDocComment[$key].'$@is',$param)){
137
+                    if (!preg_match('@^'.$routeFromDocComment[$key].'$@is', $param)) {
138 138
                         exception()
139 139
                             ->invalidArgument('route '.$key.' value is not valid for configuration as pattern');
140 140
                     }
141 141
                 }
142
-                else{
142
+                else {
143 143
 
144
-                    if(isset($pattern[$key])){
144
+                    if (isset($pattern[$key])) {
145 145
 
146
-                        if(!preg_match('@'.$pattern[$key].'$@is',$param)){
146
+                        if (!preg_match('@'.$pattern[$key].'$@is', $param)) {
147 147
                             exception()
148 148
                                 ->invalidArgument('route id value is not valid for configuration as pattern');
149 149
                         }
@@ -163,9 +163,9 @@  discard block
 block discarded – undo
163 163
     {
164 164
         // we pass all the key values โ€‹โ€‹of
165 165
         // the route data through the string control.
166
-        foreach (route() as $routeKey=>$routeValue){
166
+        foreach (route() as $routeKey=>$routeValue) {
167 167
 
168
-            if(in_array($routeKey,$this->parameters) && preg_match('@[^a-z||\?]@',$routeKey)){
168
+            if (in_array($routeKey, $this->parameters) && preg_match('@[^a-z||\?]@', $routeKey)) {
169 169
                 exception()->invalidArgument('Route key should be only string value');
170 170
             }
171 171
         }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -138,8 +138,7 @@
 block discarded – undo
138 138
                         exception()
139 139
                             ->invalidArgument('route '.$key.' value is not valid for configuration as pattern');
140 140
                     }
141
-                }
142
-                else{
141
+                } else{
143 142
 
144 143
                     if(isset($pattern[$key])){
145 144
 
Please login to merge, or discard this patch.