Separate package type from view representation

main
Alexander Schwenn 7 years ago
parent 308fa88746
commit e672628565

@ -234,14 +234,14 @@ EOT
foreach ($repos as $repo) { foreach ($repos as $repo) {
if ($repo === $platformRepo) { if ($repo === $platformRepo) {
$type = '<info>platform</info>:'; $type = 'platform';
} elseif ( } elseif (
$repo === $installedRepo $repo === $installedRepo
|| ($installedRepo instanceof CompositeRepository && in_array($repo, $installedRepo->getRepositories(), true)) || ($installedRepo instanceof CompositeRepository && in_array($repo, $installedRepo->getRepositories(), true))
) { ) {
$type = '<info>installed</info>:'; $type = 'installed';
} else { } else {
$type = '<comment>available</comment>:'; $type = 'available';
} }
if ($repo instanceof ComposerRepository && $repo->hasProviders()) { if ($repo instanceof ComposerRepository && $repo->hasProviders()) {
foreach ($repo->getProviderNames() as $name) { foreach ($repo->getProviderNames() as $name) {
@ -270,7 +270,7 @@ EOT
$showMinorOnly = $input->getOption('minor-only'); $showMinorOnly = $input->getOption('minor-only');
$indent = $showAllTypes ? ' ' : ''; $indent = $showAllTypes ? ' ' : '';
$latestPackages = array(); $latestPackages = array();
foreach (array('<info>platform</info>:' => true, '<comment>available</comment>:' => false, '<info>installed</info>:' => true) as $type => $showVersion) { foreach (array('platform' => true, 'available' => false, 'installed' => true) as $type => $showVersion) {
if (isset($packages[$type])) { if (isset($packages[$type])) {
ksort($packages[$type]); ksort($packages[$type]);
@ -320,7 +320,11 @@ EOT
$hasOutdatedPackages = false; $hasOutdatedPackages = false;
if ($showAllTypes) { if ($showAllTypes) {
$io->write($type); if ('available' === $type) {
$io->write('<comment>' . $type . '</comment>:');
} else {
$io->write('<info>' . $type . '</info>:');
}
} }
foreach ($packages[$type] as $package) { foreach ($packages[$type] as $package) {
if (is_object($package)) { if (is_object($package)) {

Loading…
Cancel
Save