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:----AfvN9UZxSXk4pHlHHGYi35+qsXRkBU7nqfU53QLuwORd378/NPOhelYoFaCUvId9qAU3HklA8hC78vWN1xZkGKEH4YzwdAcX0U5lafu+/F4YHADkdTYnqN5Jwd9HFjbHdHtyzXOlMkKBdaPcBp1CvTE2ieUahzVpn6OYnYbeKcRYFizM+yVtX73qa+z8kdgsx4aZA9sgkku22vHJQ13hrw9DBrGoogdPlOF9BZxuwo3F/+HWwFr2NqMqI3odq4lWQvIre67mFt2gSNeD2D/apRiCS5CqZEwjpZzyFljyflGlBuP9UNTo0eb9pDizzXKNHAVXceXa0eBidQJB9hWrkebaraDbXKnRGIvaJGcubSk9wrnuUNQBqOkckYnBOs5ZllhF5zWLmjCaod+OZlW8qBFmLBtyUjdYNalhANiONNtio38x2kA6lsQOyvgQ8Pbkypg/cy7MQykzsD1JS8h/PDMjQyJDjVE5A9ur0KhydBqZ7xFpOkKXsZLoecn/xrl+yEU+zzrBx7Ou/E6Bx0I7VuBWbpyfapRRBCsSqCOjSihWCaACtFFiuVcRGfjCZojXok2O0rdddk81+ePB/lSrEch4VoKtA411Vxqqj0v6BNdUwkjCovNNbm7HeyG3dlJOu5optRahYVkvGcUdCmEpIbHav13aP6cH0WWC26ba8xU=----ATTACHMENT:----Mjk1ODIxNTgwMjgwNjc2MCA0MTM4MTk1ODA1ODk2MDU4IDgyMzA1MjA5NDAxODYwMjM=