name: RemotePackageStorage class_comment: '# * Manages the local storage of remote/vendor importmap packages.' dependencies: - name: RuntimeException type: class source: Symfony\Component\AssetMapper\Exception\RuntimeException properties: [] methods: - name: getDownloadPath visibility: public parameters: - name: packageModuleSpecifier - name: importMapType comment: "# * Manages the local storage of remote/vendor importmap packages.\n#\ \ */\n# class RemotePackageStorage\n# {\n# public function __construct(private\ \ readonly string $vendorDir)\n# {\n# }\n# \n# public function getStorageDir():\ \ string\n# {\n# return $this->vendorDir;\n# }\n# \n# public function isDownloaded(ImportMapEntry\ \ $entry): bool\n# {\n# if (!$entry->isRemotePackage()) {\n# throw new \\InvalidArgumentException(\\\ sprintf('The entry \"%s\" is not a remote package.', $entry->importName));\n#\ \ }\n# \n# return is_file($this->getDownloadPath($entry->packageModuleSpecifier,\ \ $entry->type));\n# }\n# \n# public function isExtraFileDownloaded(ImportMapEntry\ \ $entry, string $extraFilename): bool\n# {\n# if (!$entry->isRemotePackage())\ \ {\n# throw new \\InvalidArgumentException(\\sprintf('The entry \"%s\" is not\ \ a remote package.', $entry->importName));\n# }\n# \n# return is_file($this->getExtraFileDownloadPath($entry,\ \ $extraFilename));\n# }\n# \n# public function save(ImportMapEntry $entry, string\ \ $contents): void\n# {\n# if (!$entry->isRemotePackage()) {\n# throw new \\InvalidArgumentException(\\\ sprintf('The entry \"%s\" is not a remote package.', $entry->importName));\n#\ \ }\n# \n# $vendorPath = $this->getDownloadPath($entry->packageModuleSpecifier,\ \ $entry->type);\n# \n# @mkdir(\\dirname($vendorPath), 0777, true);\n# if (false\ \ === @file_put_contents($vendorPath, $contents)) {\n# throw new RuntimeException(error_get_last()['message']\ \ ?? \\sprintf('Failed to write file \"%s\".', $vendorPath));\n# }\n# }\n# \n\ # public function saveExtraFile(ImportMapEntry $entry, string $extraFilename,\ \ string $contents): void\n# {\n# if (!$entry->isRemotePackage()) {\n# throw new\ \ \\InvalidArgumentException(\\sprintf('The entry \"%s\" is not a remote package.',\ \ $entry->importName));\n# }\n# \n# $vendorPath = $this->getExtraFileDownloadPath($entry,\ \ $extraFilename);\n# \n# @mkdir(\\dirname($vendorPath), 0777, true);\n# if (false\ \ === @file_put_contents($vendorPath, $contents)) {\n# throw new RuntimeException(error_get_last()['message']\ \ ?? \\sprintf('Failed to write file \"%s\".', $vendorPath));\n# }\n# }\n# \n\ # /**\n# * The local file path where a downloaded package should be stored." - name: getExtraFileDownloadPath visibility: private parameters: - name: entry - name: extraFilename comment: null traits: - Symfony\Component\AssetMapper\Exception\RuntimeException interfaces: []