#[Package('core')]
class PluginZipDetector{ /**
* @return PluginManagementService::PLUGIN|PluginManagementService::APP
*/
public function detect(string
$zipFilePath): string
{ try { $archive = ZipUtils::
openZip($zipFilePath);
} catch (PluginExtractionException
$e) { throw PluginException::
noPluginFoundInZip($zipFilePath);
} try { return match (true
) { $this->
isPlugin($archive) => PluginManagementService::PLUGIN,
$this->
isApp($archive) => PluginManagementService::APP,
default =>
throw PluginException::
noPluginFoundInZip($zipFilePath) };
} finally { $archive->
close();
} }