| Conditions | 3 |
| Paths | 1 |
| Total Lines | 23 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 19 | protected static function getFactoryMap(): array |
||
| 20 | { |
||
| 21 | $return = []; |
||
| 22 | |||
| 23 | $return['dummy'] = DummyStorageDriver::class; |
||
| 24 | |||
| 25 | $return['local'] = function(VaultConfiguration $vaultConfiguration) |
||
| 26 | { |
||
| 27 | $path = TildeExpansion::expand($vaultConfiguration->getSetting('path')); |
||
| 28 | |||
| 29 | if (!is_dir($path) || !is_writable($path)) |
||
| 30 | { |
||
| 31 | throw new ConfigurationException(sprintf('Path "%s" does not exist or is not writable.', $path)); |
||
| 32 | } |
||
| 33 | |||
| 34 | $adapter = new Local($path); |
||
| 35 | $filesystem = new Filesystem($adapter); |
||
| 36 | |||
| 37 | return new FlysystemStorageDriver($filesystem); |
||
| 38 | }; |
||
| 39 | |||
| 40 | return $return; |
||
| 41 | } |
||
| 42 | } |
||
| 43 |