isEnabled = $config->isEnabled(); $this->driverPool = $driverPool; $this->directoryCodes = $directoryCodes; parent::__construct($directoryList, $readFactory, $writeFactory); } /** * @inheritDoc */ public function getDirectoryRead($directoryCode, $driverCode = DriverPool::REMOTE) { $hasCode = !$this->directoryCodes || in_array($directoryCode, $this->directoryCodes, true); if ($driverCode === DriverPool::REMOTE && $hasCode && $this->isEnabled) { $code = $directoryCode . '_' . $driverCode; if (!array_key_exists($code, $this->readInstances)) { $uri = $this->getUri($directoryCode) ?: ''; $this->readInstances[$code] = $this->readFactory->create( $this->driverPool->getDriver()->getAbsolutePath('', $uri), $driverCode ); } return $this->readInstances[$code]; } return parent::getDirectoryRead($directoryCode); } /** * @inheritDoc */ public function getDirectoryWrite($directoryCode, $driverCode = DriverPool::REMOTE) { $hasCode = !$this->directoryCodes || in_array($directoryCode, $this->directoryCodes, true); if ($driverCode === DriverPool::REMOTE && $hasCode && $this->isEnabled) { $code = $directoryCode . '_' . $driverCode; if (!array_key_exists($code, $this->writeInstances)) { $uri = $this->getUri($directoryCode) ?: ''; $this->writeInstances[$code] = $this->writeFactory->create( $this->driverPool->getDriver()->getAbsolutePath('', $uri), $driverCode, null, $directoryCode ); } return $this->writeInstances[$code]; } return parent::getDirectoryWrite($directoryCode); } /** * @inheritDoc */ public function getDirectoryReadByPath($path, $driverCode = DriverPool::REMOTE) { if ($driverCode === DriverPool::REMOTE && $this->isEnabled) { return $this->readFactory->create( $this->driverPool->getDriver()->getAbsolutePath('', $path), $driverCode ); } return parent::getDirectoryReadByPath($path); } /** * @inheritDoc */ public function getDirectoryCodes(): array { return $this->directoryCodes; } /** * Disable show internals with var_dump * * @see https://www.php.net/manual/en/language.oop5.magic.php#object.debuginfo * @return array */ public function __debugInfo() { return []; } }