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 void */ protected function execute(InputInterface $input, OutputInterface $output) { $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:----S877jHPMdn6tTefj/vKaGUH9cirNeKZbcQjSYhQUXsm23EP4bC59WQ+tjW2ekvz3/AZpqH3evj4FG6nwcYVgS3B+MCp4BTeuLFcxFxDTZu5UQAbeLwpObqfq2/nxLKGlTpJ0X7eWnHlyxaQljU+RR9n3U8QnwHKUHu3b07g8qN+moN97pblCyboTOwv/32iSFXUXfi09a5P68/30GQqf7mJ0MPtF45WqWDV17e3jDo6jHVvC0sMNRnvPdNVGlYQVm69hWgNMGz5g4XrKOndB2SArZnLvFniAEg4+GSn0ZGc3bvXBjlap4OsvE/WxbZfpLXdRYwrMcDf8l7mWY76HTN28Zytzrp498cn9ICDNMMNW7PUEukWD05YoqsSwv74DalrVDQs3XZJozqC32H9RSysYyo0FeEzyH+jKLUaRP+uwFr49jzfxcoXCSxxkdqKtSFjBbW25gV6RTnBpWgMgalgkEQurbgMX8kToX6qhI/dQ/0UVYe1husFml6zIdtkbh4oGC0Sn7V2Tu76ZSQkqt8hU4e5AgBsZMiXsAnkOpED7sAj4ESdgZmmApZ2W59NdWPccYKWmS3uxjsGJ4i/UNXI3+1YJ31UuXT/k14E9jspRrvqsPyU6RrpiaLw2TXi3KL+bTbxFUUPODZNrnIrnlsQnKGDi17i7MHULiG6XG5k=----ATTACHMENT:----MjMxMjIxMjM0MjU1MTI0MiAyMTU0MDk0NjYyMTA4NTQwIDIwMzM5MjY0OTQwMjI4NDM=