Passed
Push — main ( 64d118...926bf9 )
by Thierry
12:47 queued 10:53
created
src/register.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
 function _register(): void
20 20
 {
21 21
     $di = jaxon()->di();
22
-    if(!$di->h(StorageManager::class))
22
+    if (!$di->h(StorageManager::class))
23 23
     {
24 24
         // File storage
25 25
         $di->set(StorageManager::class, function($c): StorageManager { 
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 function register()
41 41
 {
42 42
     // Do nothing if running in cli.
43
-    if(php_sapi_name() !== 'cli')
43
+    if (php_sapi_name() !== 'cli')
44 44
     {
45 45
         _register();
46 46
     };
Please login to merge, or discard this patch.
src/StorageManager.php 1 patch
Spacing   +9 added lines, -10 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
     /**
32 32
      * @var array<string, Closure>
33 33
      */
34
-    protected $aAdapters = [];
34
+    protected $aAdapters = [ ];
35 35
 
36 36
     /**
37 37
      * The constructor
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
      */
55 55
     public function register(string $sAdapter, Closure $cFactory)
56 56
     {
57
-        $this->aAdapters[$sAdapter] = $cFactory;
57
+        $this->aAdapters[ $sAdapter ] = $cFactory;
58 58
     }
59 59
 
60 60
     /**
@@ -66,8 +66,7 @@  discard block
 block discarded – undo
66 66
     {
67 67
         // Local file system adapter
68 68
         $this->register('local', function(string $sRootDir, $xOptions) {
69
-            return empty($xOptions) ? new LocalFilesystemAdapter($sRootDir) :
70
-                new LocalFilesystemAdapter($sRootDir, $xOptions);
69
+            return empty($xOptions) ? new LocalFilesystemAdapter($sRootDir) : new LocalFilesystemAdapter($sRootDir, $xOptions);
71 70
         });
72 71
     }
73 72
 
@@ -79,15 +78,15 @@  discard block
 block discarded – undo
79 78
      * @return Filesystem
80 79
      * @throws RequestException
81 80
      */
82
-    public function make(string $sAdapter, string $sRootDir, array $aOptions = []): Filesystem
81
+    public function make(string $sAdapter, string $sRootDir, array $aOptions = [ ]): Filesystem
83 82
     {
84
-        if(!isset($this->aAdapters[$sAdapter]) || !is_callable($this->aAdapters[$sAdapter]))
83
+        if (!isset($this->aAdapters[ $sAdapter ]) || !is_callable($this->aAdapters[ $sAdapter ]))
85 84
         {
86 85
             $this->logger->error("Jaxon Storage: adapter '$sAdapter' not configured.");
87 86
             throw new RequestException($this->xTranslator->trans('errors.storage.adapter'));
88 87
         }
89 88
 
90
-        return new Filesystem(($this->aAdapters[$sAdapter])($sRootDir, $aOptions));
89
+        return new Filesystem(($this->aAdapters[ $sAdapter ])($sRootDir, $aOptions));
91 90
     }
92 91
 
93 92
     /**
@@ -99,7 +98,7 @@  discard block
 block discarded – undo
99 98
     public function get(string $sOptionName): Filesystem
100 99
     {
101 100
         $sConfigKey = "storage.$sOptionName";
102
-        if(!$this->xConfigManager->hasAppOption($sConfigKey))
101
+        if (!$this->xConfigManager->hasAppOption($sConfigKey))
103 102
         {
104 103
             $this->logger->error("Jaxon Storage: No '$sConfigKey' in options.");
105 104
             throw new RequestException($this->xTranslator->trans('errors.storage.options'));
@@ -107,8 +106,8 @@  discard block
 block discarded – undo
107 106
 
108 107
         $sAdapter = $this->xConfigManager->getAppOption("$sConfigKey.adapter");
109 108
         $sRootDir = $this->xConfigManager->getAppOption("$sConfigKey.dir");
110
-        $aOptions = $this->xConfigManager->getAppOption("$sConfigKey.options", []);
111
-        if(!is_string($sAdapter) || !is_string($sRootDir) || !is_array($aOptions))
109
+        $aOptions = $this->xConfigManager->getAppOption("$sConfigKey.options", [ ]);
110
+        if (!is_string($sAdapter) || !is_string($sRootDir) || !is_array($aOptions))
112 111
         {
113 112
             $this->logger->error("Jaxon Storage: incorrect values in '$sConfigKey' options.");
114 113
             throw new RequestException($this->xTranslator->trans('errors.storage.options'));
Please login to merge, or discard this patch.