fileManager = new FileManager(); } 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 RuntimeException */ protected function putPhpContentsInternal(string $path, array $data, bool $useRenaming = false): void { $result = $this->fileManager->putPhpContents($path, $data, true, $useRenaming); if ($result === false) { throw new RuntimeException(); } } /** * @param array $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); } /** * @return array * @throws Error */ public function getPhpContents(string $path): array { $data = $this->fileManager->getPhpContents($path); if (!is_array($data)) { throw new Error("Bad data stored in '{$path}."); } /** @var array */ return $data; } }