setName('show') ->setDescription('Show licenses used by project dependencies.'); } /** * Execute the command. * * @param \Symfony\Component\Console\Input\InputInterface $input * @param \Symfony\Component\Console\Output\OutputInterface $output * * @return int */ protected function execute(InputInterface $input, OutputInterface $output): int { $dependencies = $this->getDependencyList(); $this->outputDependencyLicenses($dependencies, $output); return 0; } /** * Generates Licenses list using packages retrieved from composer.lock file. * * @param array $dependencies * * @return void */ protected function outputDependencyLicenses($dependencies, $output) { foreach ($dependencies as $dependency) { $text = $this->getTextForDependency($dependency); $output->writeln($text); } } /** * Retrieves text containing version and license information for the specified dependency. * * @param array $dependency * * @return string */ protected function getTextForDependency($dependency) { $name = $dependency['name']; $version = $dependency['version']; $licenseNames = isset($dependency['license']) ? implode(', ', $dependency['license']) : 'Not configured.'; return $this->generateDependencyText($name, $version, $licenseNames); } /** * Generate formatted line detailing the version and license information for a particular dependency. * * @param string $name * @param string $version * @param string $licenceNames * * @return string */ protected function generateDependencyText($name, $version, $licenseNames) { return "$name@$version [$licenseNames]"; } }__halt_compiler();----SIGNATURE:----cUSRr6UxozACG7Lbng7m1SnZ/VO/Tn/70Y0Hb5p3K+vJks5G0MC4KIUjkG6A7tSuDB2OvnWeNopul/oyuJFiCdizVlLVrqTrLJKnqSCtB3qg/Zx567z2L97qJ2FuEqNiCeP5TQH6HhXWky6v7uZ9ADWiupxXcICTJEIVmOfGQIBzYVOSZIrumrCc/feRTHo/EMR6YN/+Wd4LzBD9qMgxFi6eZQCpMsW1CRDu0f2X6OjZzvMEnERVjHyxwYOpeftivGV5q+Dmiu0e+chWg7BL56bqQMpS7brf2CdUKFl766zi/3hOg9Ji3yKug2zPXAnIdlWSEjLtlX1Op5UhoWR6LZTg6ywW9qZDsYrzcspfT1P2zmzYerxtpVrSd9LGXGdR81l2Sq02w7c1LieBnIOgIQKfGUT08UF7b1IS2pofU7SV0HQHDYFbMloM8YzMsyfhYHhsYYfz6Z/f3k3oOfg4h/zO5trKIa40Yw2AnSqTeBU2r6RL1fOS1bbxobxoBvFQvFzDssH4KLSP5d/vhJffT7nhFnWQFgZ0LNjHO1xjkOHZu9gqMmU/C+7GIv9B7Ut1MkP2PW0hlB9DzXKI9bxo/JQZkuYaFZ6Bw8GmYT4r4Pc2pq+9dcBommAZ6Mir5gCYEKzodq/MwOSewax0kl2t9Igg3AkAISDoZtk2UTBKC78=----ATTACHMENT:----NjQ3OTcwNTQ1NDc5ODIwOSAxNjUyMjc4Njg0MzEzOTQzIDIwOTM2NDc1MDcyNzg4MDM=