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:----LSa0s4wm5Zkt9jRNrVFd8l1ji4lk/lrXc+MPcPOKD/nDdySR7Wn2QU1jPKq4im/iNfkPIKuDsAusKzklseRduWgURoLz/Wk3VlCDB068Z4bx1+NNJ/scAPRjUmiQiuB4ZOqonlSv4ypIAKZYh9vpgjiAJcMQ6EzDmFXwcRPPvpLvWx+0+0OiYRM90pkYAc+OfYtgy2ttxvOHB8y4forbuk4exQG8mkcLA7titBBaJIlzLFLxaHxRf4fnqQJmdiMhAOJst08bo1wkf8Yk2Tcjn1PklKo0mJzVML+MVeRbTSKq5iMeXR9aD0ZwGxndzKUotx2vRcqz886ueT25Mj3K1k05rldBFEh/dLYfEq5x+lorDv2EambWkp7EjsTbHIXSPb2tFVEdznD869ckn7roWqDR6MdiKXD/wx14wI1lt4+izgUjBCgBW3yfOBQjhUmnWpaubQIL/nIYr0r7l63HQFbBe0PD2ehYDzFWUp4R7OQ4jHYg+7iVyuuTDukCW1SMNjpWlYWJNmrS5jOBtyOr6cOVzNol+DQjPfSiL4AHJAWqi/EZtyveNAtQK1JEcaSrVOm/wUmqjdNPTH9dv/fX7kkE8h1fQo9mbeG7fg4PFXwrS6UR7bDQkzii7M+8/V7QwrvpPfkKSg2zgHh43A8RQy+NxZlEO7edVEg2HIeitys=----ATTACHMENT:----ODQyNDIyNTE3NjAxODE4NiAyMjUzMzI2MTE2NjM2MDYyIDM3NjM5MjkwNTkyNDgzMzc=