function FundCommand::insertFundingData
Parameters
mixed[] $fundings:
Return value
mixed[]
1 call to FundCommand::insertFundingData()
- FundCommand::execute in vendor/
composer/ composer/ src/ Composer/ Command/ FundCommand.php - Executes the current command.
File
-
vendor/
composer/ composer/ src/ Composer/ Command/ FundCommand.php, line 134
Class
- FundCommand
- @author Nicolas Grekas <p@tchwork.com> @author Jordi Boggiano <j.boggiano@seld.be>
Namespace
Composer\CommandCode
private function insertFundingData(array $fundings, CompletePackageInterface $package) : array {
foreach ($package->getFunding() as $fundingOption) {
[
$vendor,
$packageName,
] = explode('/', $package->getPrettyName());
// ignore malformed funding entries
if (empty($fundingOption['url'])) {
continue;
}
$url = $fundingOption['url'];
if (!empty($fundingOption['type']) && $fundingOption['type'] === 'github' && Preg::isMatch('{^https://github.com/([^/]+)$}', $url, $match)) {
$url = 'https://github.com/sponsors/' . $match[1];
}
$fundings[$vendor][$url][] = $packageName;
}
return $fundings;
}