app->make(ModuleManager::class) ->getModule($this->extensionIdentifier); if ($module !== null) { return $module; } return new InlineModuleExtensionAdapter($this->extensionIdentifier); } /** * Register services. */ public function register(): void { $this->ensureIdentifierAlias(); parent::register(); } /** * Bootstrap services. */ public function boot(): void { $this->ensureIdentifierAlias(); parent::boot(); } /** * `$moduleIdentifier` 값을 부모의 `$extensionIdentifier` 로 미러링합니다. */ private function ensureIdentifierAlias(): void { if (isset($this->moduleIdentifier) && ! isset($this->extensionIdentifier)) { $this->extensionIdentifier = $this->moduleIdentifier; } } /** * @deprecated 7.0.0-beta.7 부모 `loadExtensionMigrations()` 사용 권장. */ protected function loadModuleMigrations(): void { $this->loadExtensionMigrations(); } /** * @deprecated 7.0.0-beta.7 부모 `loadExtensionTranslations()` 사용 권장. */ protected function loadModuleTranslations(): void { $this->loadExtensionTranslations(); } } /** * ModuleManager 가 식별자 매핑을 보유하지 않는 컨텍스트에서 사용되는 어댑터. * * AbstractModule::getCache() / getStorage() 와 동일한 키 prefix·디스크 정책을 * 따르도록 ModuleCacheDriver / ModuleStorageDriver 를 직접 생성합니다. * * @internal BaseModuleServiceProvider 의 fallback 전용. */ final class InlineModuleExtensionAdapter implements CacheableExtensionInterface { private ?CacheInterface $cache = null; private ?StorageInterface $storage = null; /** * @param string $identifier 모듈 식별자 (vendor-module) */ public function __construct(private readonly string $identifier) {} /** * 모듈 식별자를 반환합니다. * * @return string 모듈 식별자 */ public function getIdentifier(): string { return $this->identifier; } /** * 모듈 도메인 캐시 드라이버를 반환합니다. * * @return CacheInterface ModuleCacheDriver 인스턴스 */ public function getCache(): CacheInterface { return $this->cache ??= new ModuleCacheDriver($this->identifier); } /** * 모듈 도메인 스토리지 드라이버를 반환합니다. * * @return StorageInterface ModuleStorageDriver 인스턴스 */ public function getStorage(): StorageInterface { return $this->storage ??= new ModuleStorageDriver($this->identifier); } /** * 카테고리별 스토리지 드라이버를 반환합니다. * * fallback 어댑터는 모듈 인스턴스(오버라이드 지점)가 없으므로 기본 스토리지를 그대로 반환합니다. * * @param string $category 카테고리 * @return StorageInterface 기본 디스크의 스토리지 인스턴스 */ public function getStorageFor(string $category): StorageInterface { return $this->getStorage(); } }