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:----ZQ9ERrPgGDMunXJcxqtXsr7pQXqg8NCDOCeBVAfZt6xY3woRfLkYZGIwbDM1I4m8sQ3Y8eOgKwYhq+Od9KM9/eJZhV7hvxKHv/J9lyaTupf+up9RGeUxCq3FMcPaHnenlUTN+BBM8v1ewDJLb49l8x0FU8UueAz3bNPIqCFTDjt+oA17SdPGrj3kmIWoSTqLj4vXcTBP/8mIS8D+4KzGBXJqS9cU/vMqSt2xUHmbLSgrP3UMXtqDEIHhX2Sa+jWv9vc/nYSk3BQpWU+TdcSOrAjyOWJCWWsLsN9K2TRiWAlYtz4sKjC+z8yLUmawjQKlVDm3SNSoRZZoTldsoIHUqZWxklurNLkikrR6cR1QUhuO892dUS71Z6YVb6IM/n0Vpk5Am9SfyLze87Df2nR5Cz0oOWYsNPIr8AAmtNKs6rXkzcHXWCsG/CwUPHtVX6IXNRpQb4UCgFnnTsH4VYGIEtGmAWubG1OMi3HBAnJIs1aRuRvrklQM4D9+a7dvc4kivichX+l5F9Z1F6YRgxLqNmvQoWnY9658yq3gHlN51ydWmur6WXrzJjooze6dpx0gewdWeiZOkrwgUZtCmZJT8YhuuG3oV7fng3tF8SPvyHrBUeN07QUQTSMbDx9p1txoqhpwnYa9izZHBj+h9kSieDojZlm2WuUsXL5QesdeZnM=----ATTACHMENT:----NzQ4MjUwOTIzMDM2MTg4MiA1NTEwMTkxNTQyNDgxNTMxIDg0NjA0NTY4MTU2NjMzNDE=