| Conditions | 4 |
| Paths | 1 |
| Total Lines | 26 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 20 | protected static function getFactoryMap(): array |
||
| 21 | { |
||
| 22 | $return = []; |
||
| 23 | |||
| 24 | $return['local'] = function(VaultConfiguration $vaultConfiguration) |
||
| 25 | { |
||
| 26 | if (!($path = $vaultConfiguration->getSetting('path'))) |
||
| 27 | { |
||
| 28 | throw new ConflictException("Missing vault config setting 'path' for vault '{$vaultConfiguration->getTitle()}'.'"); |
||
| 29 | } |
||
| 30 | |||
| 31 | $path = PathUtils::getAbsolutePath($path); |
||
| 32 | |||
| 33 | if (!is_dir($path) || !is_writable($path)) |
||
| 34 | { |
||
| 35 | throw new ConfigurationException(sprintf('Path "%s" does not exist or is not writable.', $path)); |
||
| 36 | } |
||
| 37 | |||
| 38 | $adapter = new Local($path); |
||
| 39 | $filesystem = new Filesystem($adapter); |
||
| 40 | |||
| 41 | return new FlysystemStorageDriver($filesystem); |
||
| 42 | }; |
||
| 43 | |||
| 44 | return $return; |
||
| 45 | } |
||
| 46 | } |
||
| 47 |