function HomeCommand::handlePackage
1 call to HomeCommand::handlePackage()
- HomeCommand::execute in vendor/
composer/ composer/ src/ Composer/ Command/ HomeCommand.php - Executes the current command.
File
-
vendor/
composer/ composer/ src/ Composer/ Command/ HomeCommand.php, line 99
Class
- HomeCommand
- @author Robert Schönthal <seroscho@googlemail.com>
Namespace
Composer\CommandCode
private function handlePackage(CompletePackageInterface $package, bool $showHomepage, bool $showOnly) : bool {
$support = $package->getSupport();
$url = $support['source'] ?? $package->getSourceUrl();
if (!$url || $showHomepage) {
$url = $package->getHomepage();
}
if (!$url || !filter_var($url, FILTER_VALIDATE_URL)) {
return false;
}
if ($showOnly) {
$this->getIO()
->write(sprintf('<info>%s</info>', $url));
}
else {
$this->openBrowser($url);
}
return true;
}