get('defaultPermissions'); } $this->fileManager = new FileManager($defaultPermissionsToSet); } public function setConfig(Config $config): void { $this->fileManager = new FileManager( $config->get('defaultPermissions') ); } public function isFile(string $filePath): bool { return $this->fileManager->isFile($filePath); } /** * @param array $data * @throws Error */ protected function putPhpContentsInternal(string $path, array $data, bool $useRenaming = false): void { $result = $this->fileManager->putPhpContents($path, $data, true, $useRenaming); if ($result === false) { throw new Error(); } } /** * @param array $data $data */ public function putPhpContents(string $path, array $data): void { $this->putPhpContentsInternal($path, $data, true); } /** * @param array $data */ public function putPhpContentsNoRenaming(string $path, array $data): void { $this->putPhpContentsInternal($path, $data, false); } /** * Supposed to return array. False means the file is being written or corrupted. * @return array|false */ public function getPhpContents(string $path) { try { $data = $this->fileManager->getPhpContents($path); } catch (Error $e) { return false; } if (!is_array($data)) { return false; } /** @var array */ return $data; } }