(?string $sourceId = null)
| 34 | } |
| 35 | |
| 36 | public static function getAdapter(?string $sourceId = null): StorageAdapterInterface |
| 37 | { |
| 38 | if (self::$legacyAdapter !== null) { |
| 39 | if (!class_exists('SourceContext') || !SourceContext::sourcesEnabled()) { |
| 40 | return self::$legacyAdapter; |
| 41 | } |
| 42 | } |
| 43 | |
| 44 | $sourceId = $sourceId ?? (class_exists('SourceContext') ? SourceContext::getActiveId() : 'local'); |
| 45 | if (isset(self::$adapters[$sourceId])) { |
| 46 | return self::$adapters[$sourceId]; |
| 47 | } |
| 48 | |
| 49 | $adapter = StorageFactory::createAdapterForSource($sourceId); |
| 50 | self::$adapters[$sourceId] = $adapter; |
| 51 | return $adapter; |
| 52 | } |
| 53 | } |
no test coverage detected