Fix licenses command summary to count all licenses of a package
parent
8756f54da0
commit
6ea5b84bd9
|
@ -93,7 +93,7 @@ EOT
|
||||||
$tableStyle->setVerticalBorderChar('');
|
$tableStyle->setVerticalBorderChar('');
|
||||||
}
|
}
|
||||||
$tableStyle->setCellRowContentFormat('%s ');
|
$tableStyle->setCellRowContentFormat('%s ');
|
||||||
$table->setHeaders(array('Name', 'Version', 'License'));
|
$table->setHeaders(array('Name', 'Version', 'Licenses'));
|
||||||
foreach ($packages as $package) {
|
foreach ($packages as $package) {
|
||||||
$table->addRow(array(
|
$table->addRow(array(
|
||||||
$package->getPrettyName(),
|
$package->getPrettyName(),
|
||||||
|
@ -124,13 +124,16 @@ EOT
|
||||||
case 'summary':
|
case 'summary':
|
||||||
$usedLicenses = array();
|
$usedLicenses = array();
|
||||||
foreach ($packages as $package) {
|
foreach ($packages as $package) {
|
||||||
$license = $package instanceof CompletePackageInterface ? $package->getLicense() : array();
|
$licenses = $package instanceof CompletePackageInterface ? $package->getLicense() : array();
|
||||||
$licenseName = array_key_exists(0, $license) ? $license[0] : 'none';
|
if (count($licenses) === 0) {
|
||||||
|
$licenses[] = 'none';
|
||||||
if (!isset($usedLicenses[$licenseName])) {
|
}
|
||||||
$usedLicenses[$licenseName] = 0;
|
foreach ($licenses as $licenseName) {
|
||||||
|
if (!isset($usedLicenses[$licenseName])) {
|
||||||
|
$usedLicenses[$licenseName] = 0;
|
||||||
|
}
|
||||||
|
$usedLicenses[$licenseName]++;
|
||||||
}
|
}
|
||||||
$usedLicenses[$licenseName]++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sort licenses so that the most used license will appear first
|
// Sort licenses so that the most used license will appear first
|
||||||
|
|
Loading…
Reference in New Issue