Passed
Push — main ( 3607b0...fd5484 )
by Thierry
03:47
created
jaxon-upload/tests/TestUpload/UploadFsLocalTest.php 1 patch
Switch Indentation   +130 added lines, -130 removed lines patch added patch discarded remove patch
@@ -19,163 +19,163 @@
 block discarded – undo
19 19
 
20 20
 class UploadFsLocalTest extends TestCase
21 21
 {
22
-    /**
22
+/**
23 23
      * @var string
24 24
      */
25
-    protected $sNameWhite;
25
+protected $sNameWhite;
26 26
 
27
-    /**
27
+/**
28 28
      * @var string
29 29
      */
30
-    protected $sPathWhite;
30
+protected $sPathWhite;
31 31
 
32
-    /**
32
+/**
33 33
      * @var int
34 34
      */
35
-    protected $sSizeWhite;
35
+protected $sSizeWhite;
36 36
 
37
-    /**
37
+/**
38 38
      * @var string
39 39
      */
40
-    protected $sNameBlue;
40
+protected $sNameBlue;
41 41
 
42
-    /**
42
+/**
43 43
      * @var string
44 44
      */
45
-    protected $sPathBlue;
45
+protected $sPathBlue;
46 46
 
47
-    /**
47
+/**
48 48
      * @var int
49 49
      */
50
-    protected $sSizeBlue;
50
+protected $sSizeBlue;
51 51
 
52
-    /**
52
+/**
53 53
      * @throws SetupException
54 54
      */
55
-    public function setUp(): void
56
-    {
57
-        jaxon()->di()->getPluginManager()->registerPlugins();
58
-        jaxon()->setOption('core.response.send', false);
59
-        jaxon()->setOption('upload.default.dir', __DIR__ . '/../upload/dst');
60
-        _register();
61
-
62
-        $tmpDir = __DIR__ . '/../upload/tmp';
63
-        @mkdir($tmpDir);
64
-
65
-        $sSrcWhite = __DIR__ . '/../upload/src/white.png';
66
-        $this->sNameWhite = 'white.png';
67
-        $this->sPathWhite = "$tmpDir/{$this->sNameWhite}";
68
-        $this->sSizeWhite = filesize($sSrcWhite);
69
-        // Copy the file to the temp dir.
70
-        @copy($sSrcWhite, $this->sPathWhite);
71
-
72
-        $sSrcBlue = __DIR__ . '/../upload/src/blue.png';
73
-        $this->sNameBlue = 'blue.png';
74
-        $this->sPathBlue = "$tmpDir/{$this->sNameBlue}";
75
-        $this->sSizeBlue = filesize($sSrcBlue);
76
-        // Copy the file to the temp dir.
77
-        @copy($sSrcBlue, $this->sPathBlue);
78
-    }
79
-
80
-    /**
55
+public function setUp(): void
56
+{
57
+jaxon()->di()->getPluginManager()->registerPlugins();
58
+jaxon()->setOption('core.response.send', false);
59
+jaxon()->setOption('upload.default.dir', __DIR__ . '/../upload/dst');
60
+_register();
61
+
62
+$tmpDir = __DIR__ . '/../upload/tmp';
63
+@mkdir($tmpDir);
64
+
65
+$sSrcWhite = __DIR__ . '/../upload/src/white.png';
66
+$this->sNameWhite = 'white.png';
67
+$this->sPathWhite = "$tmpDir/{$this->sNameWhite}";
68
+$this->sSizeWhite = filesize($sSrcWhite);
69
+// Copy the file to the temp dir.
70
+@copy($sSrcWhite, $this->sPathWhite);
71
+
72
+$sSrcBlue = __DIR__ . '/../upload/src/blue.png';
73
+$this->sNameBlue = 'blue.png';
74
+$this->sPathBlue = "$tmpDir/{$this->sNameBlue}";
75
+$this->sSizeBlue = filesize($sSrcBlue);
76
+// Copy the file to the temp dir.
77
+@copy($sSrcBlue, $this->sPathBlue);
78
+}
79
+
80
+/**
81 81
      * @throws SetupException
82 82
      */
83
-    public function tearDown(): void
84
-    {
85
-        jaxon()->reset();
86
-        parent::tearDown();
87
-    }
83
+public function tearDown(): void
84
+{
85
+jaxon()->reset();
86
+parent::tearDown();
87
+}
88 88
 
89
-    /**
89
+/**
90 90
      * @throws RequestException
91 91
      */
92
-    public function testHttpUploadDisabled()
93
-    {
94
-        jaxon()->setOption('core.upload.enabled', false);
95
-        jaxon()->register(Jaxon::CALLABLE_CLASS, 'SampleUpload', __DIR__ . '/../src/sample.php');
96
-
97
-        // Send a request to the registered class
98
-        jaxon()->di()->set(ServerRequestInterface::class, function($c) {
99
-            return $c->g(ServerRequestCreator::class)
100
-                ->fromGlobals()
101
-                ->withUploadedFiles([
102
-                    'image' => new UploadedFile($this->sPathWhite, $this->sSizeWhite,
103
-                        UPLOAD_ERR_OK, $this->sNameWhite, 'png'),
104
-                ])
105
-                ->withMethod('POST');
106
-        });
107
-
108
-        $this->assertFalse(jaxon()->di()->getRequestHandler()->canProcessRequest());
109
-    }
110
-
111
-    /**
92
+public function testHttpUploadDisabled()
93
+{
94
+jaxon()->setOption('core.upload.enabled', false);
95
+jaxon()->register(Jaxon::CALLABLE_CLASS, 'SampleUpload', __DIR__ . '/../src/sample.php');
96
+
97
+// Send a request to the registered class
98
+jaxon()->di()->set(ServerRequestInterface::class, function($c) {
99
+return $c->g(ServerRequestCreator::class)
100
+    ->fromGlobals()
101
+    ->withUploadedFiles([
102
+        'image' => new UploadedFile($this->sPathWhite, $this->sSizeWhite,
103
+            UPLOAD_ERR_OK, $this->sNameWhite, 'png'),
104
+    ])
105
+    ->withMethod('POST');
106
+});
107
+
108
+$this->assertFalse(jaxon()->di()->getRequestHandler()->canProcessRequest());
109
+}
110
+
111
+/**
112 112
      * @throws RequestException
113 113
      */
114
-    public function testRequestWithNoPluginNoUpload()
115
-    {
116
-        jaxon()->setOption('core.upload.enabled', false);
117
-        jaxon()->register(Jaxon::CALLABLE_CLASS, 'SampleUpload', __DIR__ . '/../src/sample.php');
118
-
119
-        // Send a request to the registered class
120
-        jaxon()->di()->set(ServerRequestInterface::class, function($c) {
121
-            return $c->g(ServerRequestCreator::class)
122
-                ->fromGlobals()
123
-                ->withParsedBody([
124
-                    'jxncall' => json_encode([
125
-                        'who' => 'Nobody',
126
-                        'args' => [],
127
-                    ]),
128
-                ])
129
-                ->withMethod('POST');
130
-        });
131
-
132
-        $this->assertFalse(jaxon()->di()->getRequestHandler()->canProcessRequest());
133
-    }
134
-
135
-    /**
114
+public function testRequestWithNoPluginNoUpload()
115
+{
116
+jaxon()->setOption('core.upload.enabled', false);
117
+jaxon()->register(Jaxon::CALLABLE_CLASS, 'SampleUpload', __DIR__ . '/../src/sample.php');
118
+
119
+// Send a request to the registered class
120
+jaxon()->di()->set(ServerRequestInterface::class, function($c) {
121
+return $c->g(ServerRequestCreator::class)
122
+    ->fromGlobals()
123
+    ->withParsedBody([
124
+        'jxncall' => json_encode([
125
+            'who' => 'Nobody',
126
+            'args' => [],
127
+        ]),
128
+    ])
129
+    ->withMethod('POST');
130
+});
131
+
132
+$this->assertFalse(jaxon()->di()->getRequestHandler()->canProcessRequest());
133
+}
134
+
135
+/**
136 136
      * @throws RequestException
137 137
      */
138
-    public function testUploadInMemoryStorage()
139
-    {
140
-        jaxon()->setOption('core.upload.enabled', true);
141
-        jaxon()->setOption('upload.default.storage', 'memory');
142
-        jaxon()->register(Jaxon::CALLABLE_CLASS, 'SampleUpload', __DIR__ . '/../src/sample.php');
143
-
144
-        // In memory file system adapter
145
-        jaxon()->upload()->registerStorageAdapter('memory',
146
-            fn() => new InMemoryFilesystemAdapter());
147
-
148
-        // Send a request to the registered class
149
-        jaxon()->di()->set(ServerRequestInterface::class, function($c) {
150
-            return $c->g(ServerRequestCreator::class)
151
-                ->fromGlobals()
152
-                ->withParsedBody([
153
-                    'jxncall' => json_encode([
154
-                        'type' => 'class',
155
-                        'name' => 'SampleUpload',
156
-                        'method' => 'myMethod',
157
-                        'args' => [],
158
-                    ]),
159
-                ])
160
-                ->withUploadedFiles([
161
-                    'image' => new UploadedFile($this->sPathWhite, $this->sSizeWhite,
162
-                        UPLOAD_ERR_OK, $this->sNameWhite, 'png'),
163
-                ])
164
-                ->withMethod('POST');
165
-        });
166
-
167
-        $this->assertTrue(jaxon()->di()->getRequestHandler()->canProcessRequest());
168
-        $this->assertTrue(jaxon()->di()->getUploadHandler()->canProcessRequest(jaxon()->di()->getRequest()));
169
-        jaxon()->processRequest();
170
-
171
-        // Uploaded files
172
-        $aFiles = jaxon()->upload()->files();
173
-        $this->assertCount(1, $aFiles);
174
-        $this->assertCount(1, $aFiles['image']);
175
-        $xFile = $aFiles['image'][0];
176
-        $this->assertEquals('white', $xFile->name());
177
-        $this->assertEquals($this->sNameWhite, $xFile->filename());
178
-        $this->assertEquals('png', $xFile->type());
179
-        $this->assertEquals('png', $xFile->extension());
180
-    }
138
+public function testUploadInMemoryStorage()
139
+{
140
+jaxon()->setOption('core.upload.enabled', true);
141
+jaxon()->setOption('upload.default.storage', 'memory');
142
+jaxon()->register(Jaxon::CALLABLE_CLASS, 'SampleUpload', __DIR__ . '/../src/sample.php');
143
+
144
+// In memory file system adapter
145
+jaxon()->upload()->registerStorageAdapter('memory',
146
+fn() => new InMemoryFilesystemAdapter());
147
+
148
+// Send a request to the registered class
149
+jaxon()->di()->set(ServerRequestInterface::class, function($c) {
150
+return $c->g(ServerRequestCreator::class)
151
+    ->fromGlobals()
152
+    ->withParsedBody([
153
+        'jxncall' => json_encode([
154
+            'type' => 'class',
155
+            'name' => 'SampleUpload',
156
+            'method' => 'myMethod',
157
+            'args' => [],
158
+        ]),
159
+    ])
160
+    ->withUploadedFiles([
161
+        'image' => new UploadedFile($this->sPathWhite, $this->sSizeWhite,
162
+            UPLOAD_ERR_OK, $this->sNameWhite, 'png'),
163
+    ])
164
+    ->withMethod('POST');
165
+});
166
+
167
+$this->assertTrue(jaxon()->di()->getRequestHandler()->canProcessRequest());
168
+$this->assertTrue(jaxon()->di()->getUploadHandler()->canProcessRequest(jaxon()->di()->getRequest()));
169
+jaxon()->processRequest();
170
+
171
+// Uploaded files
172
+$aFiles = jaxon()->upload()->files();
173
+$this->assertCount(1, $aFiles);
174
+$this->assertCount(1, $aFiles['image']);
175
+$xFile = $aFiles['image'][0];
176
+$this->assertEquals('white', $xFile->name());
177
+$this->assertEquals($this->sNameWhite, $xFile->filename());
178
+$this->assertEquals('png', $xFile->type());
179
+$this->assertEquals('png', $xFile->extension());
180
+}
181 181
 }
Please login to merge, or discard this patch.
jaxon-upload/src/Manager/FileStorage.php 2 patches
Switch Indentation   +110 added lines, -110 removed lines patch added patch discarded remove patch
@@ -28,146 +28,146 @@
 block discarded – undo
28 28
 
29 29
 class FileStorage
30 30
 {
31
-    /**
31
+/**
32 32
      * @var ConfigManager
33 33
      */
34
-    protected $xConfigManager;
34
+protected $xConfigManager;
35 35
 
36
-    /**
36
+/**
37 37
      * @var Translator
38 38
      */
39
-    protected $xTranslator;
39
+protected $xTranslator;
40 40
 
41
-    /**
41
+/**
42 42
      * @var array
43 43
      */
44
-    protected $aAdapters = [];
44
+protected $aAdapters = [];
45 45
 
46
-    /**
46
+/**
47 47
      * @var array
48 48
      */
49
-    protected $aFilesystems = [];
49
+protected $aFilesystems = [];
50 50
 
51
-    /**
51
+/**
52 52
      * The constructor
53 53
      *
54 54
      * @param ConfigManager $xConfigManager
55 55
      * @param Translator $xTranslator
56 56
      */
57
-    public function __construct(ConfigManager $xConfigManager, Translator $xTranslator)
58
-    {
59
-        $this->xConfigManager = $xConfigManager;
60
-        $this->xTranslator = $xTranslator;
61
-        $this->registerAdapters();
62
-    }
63
-
64
-    /**
57
+public function __construct(ConfigManager $xConfigManager, Translator $xTranslator)
58
+{
59
+$this->xConfigManager = $xConfigManager;
60
+$this->xTranslator = $xTranslator;
61
+$this->registerAdapters();
62
+}
63
+
64
+/**
65 65
      * @param string $sStorage
66 66
      * @param Closure $cFactory
67 67
      *
68 68
      * @return void
69 69
      */
70
-    public function registerAdapter(string $sStorage, Closure $cFactory)
71
-    {
72
-        $this->aAdapters[$sStorage] = $cFactory;
73
-    }
70
+public function registerAdapter(string $sStorage, Closure $cFactory)
71
+{
72
+$this->aAdapters[$sStorage] = $cFactory;
73
+}
74 74
 
75
-    /**
75
+/**
76 76
      * Register the file storage adapters
77 77
      *
78 78
      * @return void
79 79
      */
80
-    private function registerAdapters()
81
-    {
82
-        // Local file system adapter
83
-        $this->registerAdapter('local', function(string $sRootDir, $xOptions) {
84
-            return empty($xOptions) ? new LocalFilesystemAdapter($sRootDir) :
85
-                new LocalFilesystemAdapter($sRootDir, $xOptions);
86
-        });
87
-
88
-        // AWS S3 file system adapter
89
-        $this->registerAdapter('aws-s3', function(string $sRootDir, array $aOptions) {
90
-            /** @var \Aws\S3\S3ClientInterface $client */
91
-            $client = new \Aws\S3\S3Client($aOptions['client'] ?? []);
92
-            return new \League\Flysystem\AwsS3V3\AwsS3V3Adapter($client, $aOptions['bucket'] ?? '', $sRootDir);
93
-        });
94
-
95
-        // Async AWS S3 file system adapter
96
-        $this->registerAdapter('async-aws-s3', function(string $sRootDir, array $aOptions) {
97
-            $client = isset($aOptions['client']) ? new \AsyncAws\S3\S3Client($aOptions['client']) : new \AsyncAws\S3\S3Client();
98
-            return new \League\Flysystem\AsyncAwsS3\AsyncAwsS3Adapter($client, $aOptions['bucket'] ?? '', $sRootDir);
99
-        });
100
-
101
-        // Google Cloud file system adapter
102
-        $this->registerAdapter('google-cloud', function(string $sRootDir, array $aOptions) {
103
-            $storageClient = new \Google\Cloud\Storage\StorageClient($aOptions['client'] ?? []);
104
-            $bucket = $storageClient->bucket($aOptions['bucket'] ?? '');
105
-            return new \League\Flysystem\AzureBlobStorage\GoogleCloudStorageAdapter($bucket, $sRootDir);
106
-        });
107
-
108
-        // Microsoft Azure file system adapter
109
-        $this->registerAdapter('azure-blob', function(string $sRootDir, array $aOptions) {
110
-            $client = \MicrosoftAzure\Storage\Blob\BlobRestProxy::createBlobService($aOptions['dsn']);
111
-            return new \League\Flysystem\AzureBlobStorage\AzureBlobStorageAdapter($client, $aOptions['container'], $sRootDir);
112
-        });
113
-
114
-        // FTP file system adapter
115
-        $this->registerAdapter('ftp', function(string $sRootDir, array $aOptions) {
116
-            $aOptions['root'] = $sRootDir;
117
-            $xOptions = \League\Flysystem\Ftp\FtpConnectionOptions::fromArray($aOptions);
118
-            return new \League\Flysystem\Ftp\FtpAdapter($xOptions);
119
-        });
120
-
121
-        // SFTP V2 file system adapter
122
-        $this->registerAdapter('sftp-v2', function(string $sRootDir, array $aOptions) {
123
-            $provider = new \League\Flysystem\PhpseclibV2\SftpConnectionProvider(...$aOptions);
124
-            return new \League\Flysystem\PhpseclibV2\SftpAdapter($provider, $sRootDir);
125
-        });
126
-
127
-        // SFTP V3 file system adapter
128
-        $this->registerAdapter('sftp-v3', function(string $sRootDir, array $aOptions) {
129
-            $provider = new \League\Flysystem\PhpseclibV3\SftpConnectionProvider(...$aOptions);
130
-            return new \League\Flysystem\PhpseclibV3\SftpAdapter($provider, $sRootDir);
131
-        });
132
-    }
133
-
134
-    /**
80
+private function registerAdapters()
81
+{
82
+// Local file system adapter
83
+$this->registerAdapter('local', function(string $sRootDir, $xOptions) {
84
+return empty($xOptions) ? new LocalFilesystemAdapter($sRootDir) :
85
+    new LocalFilesystemAdapter($sRootDir, $xOptions);
86
+});
87
+
88
+// AWS S3 file system adapter
89
+$this->registerAdapter('aws-s3', function(string $sRootDir, array $aOptions) {
90
+/** @var \Aws\S3\S3ClientInterface $client */
91
+$client = new \Aws\S3\S3Client($aOptions['client'] ?? []);
92
+return new \League\Flysystem\AwsS3V3\AwsS3V3Adapter($client, $aOptions['bucket'] ?? '', $sRootDir);
93
+});
94
+
95
+// Async AWS S3 file system adapter
96
+$this->registerAdapter('async-aws-s3', function(string $sRootDir, array $aOptions) {
97
+$client = isset($aOptions['client']) ? new \AsyncAws\S3\S3Client($aOptions['client']) : new \AsyncAws\S3\S3Client();
98
+return new \League\Flysystem\AsyncAwsS3\AsyncAwsS3Adapter($client, $aOptions['bucket'] ?? '', $sRootDir);
99
+});
100
+
101
+// Google Cloud file system adapter
102
+$this->registerAdapter('google-cloud', function(string $sRootDir, array $aOptions) {
103
+$storageClient = new \Google\Cloud\Storage\StorageClient($aOptions['client'] ?? []);
104
+$bucket = $storageClient->bucket($aOptions['bucket'] ?? '');
105
+return new \League\Flysystem\AzureBlobStorage\GoogleCloudStorageAdapter($bucket, $sRootDir);
106
+});
107
+
108
+// Microsoft Azure file system adapter
109
+$this->registerAdapter('azure-blob', function(string $sRootDir, array $aOptions) {
110
+$client = \MicrosoftAzure\Storage\Blob\BlobRestProxy::createBlobService($aOptions['dsn']);
111
+return new \League\Flysystem\AzureBlobStorage\AzureBlobStorageAdapter($client, $aOptions['container'], $sRootDir);
112
+});
113
+
114
+// FTP file system adapter
115
+$this->registerAdapter('ftp', function(string $sRootDir, array $aOptions) {
116
+$aOptions['root'] = $sRootDir;
117
+$xOptions = \League\Flysystem\Ftp\FtpConnectionOptions::fromArray($aOptions);
118
+return new \League\Flysystem\Ftp\FtpAdapter($xOptions);
119
+});
120
+
121
+// SFTP V2 file system adapter
122
+$this->registerAdapter('sftp-v2', function(string $sRootDir, array $aOptions) {
123
+$provider = new \League\Flysystem\PhpseclibV2\SftpConnectionProvider(...$aOptions);
124
+return new \League\Flysystem\PhpseclibV2\SftpAdapter($provider, $sRootDir);
125
+});
126
+
127
+// SFTP V3 file system adapter
128
+$this->registerAdapter('sftp-v3', function(string $sRootDir, array $aOptions) {
129
+$provider = new \League\Flysystem\PhpseclibV3\SftpConnectionProvider(...$aOptions);
130
+return new \League\Flysystem\PhpseclibV3\SftpAdapter($provider, $sRootDir);
131
+});
132
+}
133
+
134
+/**
135 135
      * @param string $sField
136 136
      *
137 137
      * @return Filesystem
138 138
      * @throws RequestException
139 139
      */
140
-    public function filesystem(string $sField = ''): Filesystem
141
-    {
142
-        $sField = trim($sField);
143
-        if(isset($this->aFilesystems[$sField]))
144
-        {
145
-            return $this->aFilesystems[$sField];
146
-        }
147
-
148
-        // Default upload dir
149
-        $sStorage = $this->xConfigManager->getOption('upload.default.storage', 'local');
150
-        $sRootDir = $this->xConfigManager->getOption('upload.default.dir', '');
151
-        $aOptions = $this->xConfigManager->getOption('upload.default.options');
152
-        $sConfigKey = "upload.files.$sField";
153
-        if($sField !== '' && $this->xConfigManager->hasOption($sConfigKey))
154
-        {
155
-            $sStorage = $this->xConfigManager->getOption("$sConfigKey.storage", $sStorage);
156
-            $sRootDir = $this->xConfigManager->getOption("$sConfigKey.dir", $sRootDir);
157
-            $aOptions = $this->xConfigManager->getOption("$sConfigKey.options", $aOptions);
158
-        }
159
-
160
-        if(!is_string($sRootDir))
161
-        {
162
-            throw new RequestException($this->xTranslator->trans('errors.upload.dir'));
163
-        }
164
-        if(!isset($this->aAdapters[$sStorage]))
165
-        {
166
-            throw new RequestException($this->xTranslator->trans('errors.upload.adapter'));
167
-        }
168
-
169
-        $xAdapter = call_user_func($this->aAdapters[$sStorage], $sRootDir, $aOptions);
170
-        $this->aFilesystems[$sField] = new Filesystem($xAdapter);
171
-        return $this->aFilesystems[$sField];
172
-    }
140
+public function filesystem(string $sField = ''): Filesystem
141
+{
142
+$sField = trim($sField);
143
+if(isset($this->aFilesystems[$sField]))
144
+{
145
+return $this->aFilesystems[$sField];
146
+}
147
+
148
+// Default upload dir
149
+$sStorage = $this->xConfigManager->getOption('upload.default.storage', 'local');
150
+$sRootDir = $this->xConfigManager->getOption('upload.default.dir', '');
151
+$aOptions = $this->xConfigManager->getOption('upload.default.options');
152
+$sConfigKey = "upload.files.$sField";
153
+if($sField !== '' && $this->xConfigManager->hasOption($sConfigKey))
154
+{
155
+$sStorage = $this->xConfigManager->getOption("$sConfigKey.storage", $sStorage);
156
+$sRootDir = $this->xConfigManager->getOption("$sConfigKey.dir", $sRootDir);
157
+$aOptions = $this->xConfigManager->getOption("$sConfigKey.options", $aOptions);
158
+}
159
+
160
+if(!is_string($sRootDir))
161
+{
162
+throw new RequestException($this->xTranslator->trans('errors.upload.dir'));
163
+}
164
+if(!isset($this->aAdapters[$sStorage]))
165
+{
166
+throw new RequestException($this->xTranslator->trans('errors.upload.adapter'));
167
+}
168
+
169
+$xAdapter = call_user_func($this->aAdapters[$sStorage], $sRootDir, $aOptions);
170
+$this->aFilesystems[$sField] = new Filesystem($xAdapter);
171
+return $this->aFilesystems[$sField];
172
+}
173 173
 }
Please login to merge, or discard this patch.
Spacing   +5 added lines, -6 removed lines patch added patch discarded remove patch
@@ -81,8 +81,7 @@  discard block
 block discarded – undo
81 81
     {
82 82
         // Local file system adapter
83 83
         $this->registerAdapter('local', function(string $sRootDir, $xOptions) {
84
-            return empty($xOptions) ? new LocalFilesystemAdapter($sRootDir) :
85
-                new LocalFilesystemAdapter($sRootDir, $xOptions);
84
+            return empty($xOptions) ? new LocalFilesystemAdapter($sRootDir) : new LocalFilesystemAdapter($sRootDir, $xOptions);
86 85
         });
87 86
 
88 87
         // AWS S3 file system adapter
@@ -140,7 +139,7 @@  discard block
 block discarded – undo
140 139
     public function filesystem(string $sField = ''): Filesystem
141 140
     {
142 141
         $sField = trim($sField);
143
-        if(isset($this->aFilesystems[$sField]))
142
+        if (isset($this->aFilesystems[$sField]))
144 143
         {
145 144
             return $this->aFilesystems[$sField];
146 145
         }
@@ -150,18 +149,18 @@  discard block
 block discarded – undo
150 149
         $sRootDir = $this->xConfigManager->getOption('upload.default.dir', '');
151 150
         $aOptions = $this->xConfigManager->getOption('upload.default.options');
152 151
         $sConfigKey = "upload.files.$sField";
153
-        if($sField !== '' && $this->xConfigManager->hasOption($sConfigKey))
152
+        if ($sField !== '' && $this->xConfigManager->hasOption($sConfigKey))
154 153
         {
155 154
             $sStorage = $this->xConfigManager->getOption("$sConfigKey.storage", $sStorage);
156 155
             $sRootDir = $this->xConfigManager->getOption("$sConfigKey.dir", $sRootDir);
157 156
             $aOptions = $this->xConfigManager->getOption("$sConfigKey.options", $aOptions);
158 157
         }
159 158
 
160
-        if(!is_string($sRootDir))
159
+        if (!is_string($sRootDir))
161 160
         {
162 161
             throw new RequestException($this->xTranslator->trans('errors.upload.dir'));
163 162
         }
164
-        if(!isset($this->aAdapters[$sStorage]))
163
+        if (!isset($this->aAdapters[$sStorage]))
165 164
         {
166 165
             throw new RequestException($this->xTranslator->trans('errors.upload.adapter'));
167 166
         }
Please login to merge, or discard this patch.