loader = $loader; } public function canLoadPlugin(string $path) : bool{ $ext = ".phar"; return is_file($path) and substr($path, -strlen($ext)) === $ext; } /** * Loads the plugin contained in $file * * @param string $file */ public function loadPlugin(string $file) : void{ $this->loader->addPath("$file/src"); } /** * Gets the PluginDescription from the file * * @param string $file * * @return null|PluginDescription */ public function getPluginDescription(string $file) : ?PluginDescription{ $phar = new \Phar($file); if(isset($phar["plugin.yml"])){ $pluginYml = $phar["plugin.yml"]; if($pluginYml instanceof \PharFileInfo){ return new PluginDescription($pluginYml->getContent()); } } return null; } public function getAccessProtocol() : string{ return "phar://"; } }