Passed
Branch master (8aafc8)
by Php Easy Api
04:00 queued 17s
created
src/resta/Foundation/Application.php 1 patch
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 use Resta\Contracts\ApplicationHelpersContracts;
15 15
 use Resta\Foundation\Bootstrapper\Bootstrappers;
16 16
 
17
-class Application extends Kernel implements ApplicationContracts,ApplicationHelpersContracts
17
+class Application extends Kernel implements ApplicationContracts, ApplicationHelpersContracts
18 18
 {
19 19
     //get app paths
20 20
     use ApplicationPath;
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
      *
37 37
      * @param bool $console
38 38
      */
39
-    public function __construct($console=false)
39
+    public function __construct($console = false)
40 40
     {
41 41
         // get console status for cli
42 42
         $this->console = $console;
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
     {
57 57
         // the booted objects are saved to the kernel.
58 58
         // this method checks whether these objects are registered.
59
-        return (isset($this['bindings'],$this['bindings'][$object]));
59
+        return (isset($this['bindings'], $this['bindings'][$object]));
60 60
     }
61 61
 
62 62
     /**
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
         // taking care of the differences between operating system
76 76
         // and escaping arguments to prevent security issues.
77 77
         // It replaces PHP functions like exec, passthru, shell_exec and system
78
-        return $this->resolve(Command::class,['command'=>$command,'args'=>$arguments])->handle();
78
+        return $this->resolve(Command::class, ['command'=>$command, 'args'=>$arguments])->handle();
79 79
     }
80 80
 
81 81
     /**
@@ -98,9 +98,9 @@  discard block
 block discarded – undo
98 98
      * @throws DependencyException
99 99
      * @throws NotFoundException
100 100
      */
101
-    public function config($config=null)
101
+    public function config($config = null)
102 102
     {
103
-        if($this->checkBindings(__FUNCTION__)){
103
+        if ($this->checkBindings(__FUNCTION__)) {
104 104
             return Config::make($config)->get();
105 105
         }
106 106
 
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
      */
143 143
     public function detectEnvironmentForApplicationKey()
144 144
     {
145
-        if(isset($this['applicationKey'])){
145
+        if (isset($this['applicationKey'])) {
146 146
 
147 147
             // application key, but if it has a null value
148 148
             // then we move the environment value to the production environment.
@@ -158,15 +158,15 @@  discard block
 block discarded – undo
158 158
      * @param array $environment
159 159
      * @return mixed|string
160 160
      */
161
-    public function environment($environment=array())
161
+    public function environment($environment = array())
162 162
     {
163
-        if($this->checkBindings(__FUNCTION__)){
163
+        if ($this->checkBindings(__FUNCTION__)) {
164 164
 
165 165
             $arguments = (isset(func_get_args()[0]))
166 166
                 ? func_get_args()[0] : func_get_args();
167 167
 
168 168
             return $this['environment']->environment(
169
-                $arguments,$this['environmentVariables']
169
+                $arguments, $this['environmentVariables']
170 170
             );
171 171
         }
172 172
 
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
     public function isLocale()
199 199
     {
200 200
         //check environment for local
201
-        return $this->environment() === 'local';
201
+        return $this->environment()==='local';
202 202
     }
203 203
 
204 204
     /**
@@ -212,14 +212,14 @@  discard block
 block discarded – undo
212 212
 
213 213
         // with the help of reflection instance,
214 214
         // we get the kernel properties extended with the application object.
215
-        foreach ($this['reflection']($this)->getProperties() as $property){
215
+        foreach ($this['reflection']($this)->getProperties() as $property) {
216 216
             $properties[] = $property->getName();
217 217
         }
218 218
 
219 219
         // we get the names of
220 220
         // the kernel properties ended with groups through the Collection class.
221
-        [$groups] = Collection::make($properties)->partition(function($properties){
222
-            return Str::endsWith($properties,'Groups');
221
+        [$groups] = Collection::make($properties)->partition(function($properties) {
222
+            return Str::endsWith($properties, 'Groups');
223 223
         });
224 224
 
225 225
         //as a result, kernel groups are being returned.
@@ -236,8 +236,8 @@  discard block
 block discarded – undo
236 236
         $list = [];
237 237
 
238 238
         //get kernel group names with manifest method
239
-        foreach ($this->kernelGroupKeys() as $groupKey){
240
-            $list = array_merge($list,$this->manifest($groupKey));
239
+        foreach ($this->kernelGroupKeys() as $groupKey) {
240
+            $list = array_merge($list, $this->manifest($groupKey));
241 241
         }
242 242
 
243 243
         return $list;
@@ -253,10 +253,10 @@  discard block
 block discarded – undo
253 253
     {
254 254
         // it adds the values in path data specified
255 255
         // by callback to the configuration values.
256
-        if($this['config'] instanceof ConfigProviderContracts){
256
+        if ($this['config'] instanceof ConfigProviderContracts) {
257 257
 
258 258
             //set your path for config loader
259
-            return tap($this['config'],function(ConfigProviderContracts $config) use($callback) {
259
+            return tap($this['config'], function(ConfigProviderContracts $config) use($callback) {
260 260
                 return $config->setConfig(call_user_func($callback));
261 261
             });
262 262
         }
@@ -271,19 +271,19 @@  discard block
 block discarded – undo
271 271
      * @param array $loaders
272 272
      * @return mixed|void
273 273
      */
274
-    public function loadIfNotExistBoot($loaders=array())
274
+    public function loadIfNotExistBoot($loaders = array())
275 275
     {
276 276
         //get kernel group list from application
277 277
         $kernelGroupList = $this->kernelGroupList();
278 278
 
279
-        foreach ($loaders as $loader){
279
+        foreach ($loaders as $loader) {
280 280
 
281 281
             // if a service needs another boot service,
282 282
             // the service is directly installed here and the service needs are resolved.
283
-            if(isset($kernelGroupList[$loader]) && $this->checkBindings($loader)===false){
283
+            if (isset($kernelGroupList[$loader]) && $this->checkBindings($loader)===false) {
284 284
 
285 285
                 //with the boot loader kernel,we get the boot loader method.
286
-                $this['closureBootLoader']->call(function() use($loader,$kernelGroupList) {
286
+                $this['closureBootLoader']->call(function() use($loader, $kernelGroupList) {
287 287
                     $this->bootstrapper = $kernelGroupList[$loader];
288 288
                     return $this->boot();
289 289
                 });
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
     public function manifest($maker)
301 301
     {
302 302
         //kernel manifest bootstrapper
303
-        return $this['bootstrapper']->bootFire(null,$maker);
303
+        return $this['bootstrapper']->bootFire(null, $maker);
304 304
     }
305 305
 
306 306
     /**
@@ -311,7 +311,7 @@  discard block
 block discarded – undo
311 311
     public function runningInConsole() : bool
312 312
     {
313 313
         //Determine if the application is running in the console.
314
-        return php_sapi_name() === 'cli' || php_sapi_name() === 'phpdbg';
314
+        return php_sapi_name()==='cli' || php_sapi_name()==='phpdbg';
315 315
     }
316 316
 
317 317
     /**
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
             : [];
328 328
 
329 329
         //core kernel providers and project providers have been merged
330
-        return array_merge($this->manifest('providers'),$providers);
330
+        return array_merge($this->manifest('providers'), $providers);
331 331
     }
332 332
 
333 333
     /**
@@ -337,12 +337,12 @@  discard block
 block discarded – undo
337 337
      * @param null $path
338 338
      * @return mixed|void
339 339
      */
340
-    public function setPaths($name=null,$path=null)
340
+    public function setPaths($name = null, $path = null)
341 341
     {
342 342
         // save the globally identified paths to
343 343
         // the global container object of the resta.
344
-        if(!is_null($name) && !is_null($path) && file_exists($path)){
345
-            $this->register('paths',$name,$path);
344
+        if (!is_null($name) && !is_null($path) && file_exists($path)) {
345
+            $this->register('paths', $name, $path);
346 346
         }
347 347
     }
348 348
 
Please login to merge, or discard this patch.