trait SchemeExtensionTrait in Flysystem 8
Same name and namespace in other branches
- 3.x src/Asset/SchemeExtensionTrait.php \Drupal\flysystem\Asset\SchemeExtensionTrait
- 2.0.x src/Asset/SchemeExtensionTrait.php \Drupal\flysystem\Asset\SchemeExtensionTrait
- 3.0.x src/Asset/SchemeExtensionTrait.php \Drupal\flysystem\Asset\SchemeExtensionTrait
Flysystem dependency injection container.
Hierarchy
- trait \Drupal\flysystem\Asset\SchemeExtensionTrait
2 files declare their use of SchemeExtensionTrait
- FlysystemServiceProvider.php in src/
FlysystemServiceProvider.php - SchemeExtensionTraitTest.php in tests/
src/ Unit/ Asset/ SchemeExtensionTraitTest.php
File
- src/
Asset/ SchemeExtensionTrait.php, line 10
Namespace
Drupal\flysystem\AssetView source
trait SchemeExtensionTrait {
/**
* Returns the scheme that should serve an extension.
*
* @param string $extension
* The extension.
*
* @return string
* The scheme that should serve the extension.
*/
public function getSchemeForExtension($extension) {
$extension_scheme = 'public';
foreach (Settings::get('flysystem', []) as $scheme => $configuration) {
if (!empty($configuration['serve_' . $extension]) && !empty($configuration['driver'])) {
// Don't break, the last configured one will win.
$extension_scheme = $scheme;
}
}
return $extension_scheme;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
SchemeExtensionTrait:: |
public | function | Returns the scheme that should serve an extension. |