Conditions | 5 |
Paths | 7 |
Total Lines | 25 |
Code Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
32 | protected function execute(InputInterface $input, OutputInterface $output): int |
||
33 | { |
||
34 | $linkedPackages = $this->plugin->getRepository()->all(); |
||
35 | if (count($linkedPackages) === 0) { |
||
36 | $output->writeln('No packages are linked'); |
||
37 | |||
38 | return 0; |
||
39 | } |
||
40 | |||
41 | $longest = 0; |
||
42 | foreach ($linkedPackages as $linkedPackage) { |
||
43 | if (strlen($linkedPackage->getName()) > $longest) { |
||
44 | $longest = strlen($linkedPackage->getName()); |
||
45 | } |
||
46 | } |
||
47 | |||
48 | foreach ($linkedPackages as $linkedPackage) { |
||
49 | $output->writeln(sprintf( |
||
50 | "%s\t%s", |
||
51 | str_pad($linkedPackage->getName(), $longest), |
||
52 | $linkedPackage->getPath() |
||
53 | )); |
||
54 | } |
||
55 | |||
56 | return 0; |
||
57 | } |
||
59 |