Add recommends and package versions to the depends command
parent
81d80b2a04
commit
83a106bd79
|
@ -46,7 +46,7 @@ EOT
|
||||||
$composer = $this->getComposer();
|
$composer = $this->getComposer();
|
||||||
$references = $this->getReferences($input, $output, $composer);
|
$references = $this->getReferences($input, $output, $composer);
|
||||||
|
|
||||||
$this->printLinks($input, $output, $references);
|
$this->printReferences($input, $output, $references);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -58,7 +58,7 @@ EOT
|
||||||
* @return array
|
* @return array
|
||||||
* @throws \InvalidArgumentException
|
* @throws \InvalidArgumentException
|
||||||
*/
|
*/
|
||||||
protected function getReferences(InputInterface $input, OutputInterface $output, Composer $composer)
|
private function getReferences(InputInterface $input, OutputInterface $output, Composer $composer)
|
||||||
{
|
{
|
||||||
$needle = $input->getArgument('package');
|
$needle = $input->getArgument('package');
|
||||||
|
|
||||||
|
@ -72,16 +72,12 @@ EOT
|
||||||
);
|
);
|
||||||
foreach ($repos as $repository) {
|
foreach ($repos as $repository) {
|
||||||
foreach ($repository->getPackages() as $package) {
|
foreach ($repository->getPackages() as $package) {
|
||||||
foreach ($package->getRequires() as $link) {
|
foreach (array('requires', 'recommends', 'suggests') as $type) {
|
||||||
|
foreach ($package->{'get'.$type}() as $link) {
|
||||||
if ($link->getTarget() === $needle) {
|
if ($link->getTarget() === $needle) {
|
||||||
$references[] = $link;
|
$references[] = array($type, $package, $link);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($package->getSuggests() as $link) {
|
|
||||||
if ($link->getTarget() === $needle) {
|
|
||||||
$references[] = $link;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -89,10 +85,10 @@ EOT
|
||||||
return $references;
|
return $references;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function printLinks(InputInterface $input, OutputInterface $output, array $links)
|
private function printReferences(InputInterface $input, OutputInterface $output, array $references)
|
||||||
{
|
{
|
||||||
foreach ($links as $link) {
|
foreach ($references as $ref) {
|
||||||
$output->writeln($link->getSource() . ' <comment>' . $link->getPrettyConstraint() . '</comment>');
|
$output->writeln($ref[1]->getPrettyName() . ' ' . $ref[1]->getPrettyVersion() . ' <info>' . $ref[0] . '</info> ' . $ref[2]->getPrettyConstraint());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue