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:----vqDOWvpSgo6YJYyT5nbXIHCpmdtUuJ/eLtLw2r94qnUsfnhQnNg4ibJWtk4YX+DoCY3LGiBHsabiTOfEZu9aovawQcXEJIJccxmhsgMjPr/dJcpi4H7Ef0yViBY8vRyEHgDAby0CboNPLHd8BmUWpguv4gRbmqX/wWepdW6iyK2EYvKNVMAdP0tAD+kgIA42yRmfyF3Oc2Q41bwLNWi8FXhGfszSGrzguOuhCEtZztDlpDdjnzBAHynuJ50nOGPciCG1phZ0VpYHBEIzs7pEFn/2EJbSIwl1C662O1bFzkS201cPIDBcSW8/wkS2hY0uEwyccgzs98QhjEVNc7crkoD55sOuDbYp/6O1UpqIXHuPtneGD0Uhj6eYKGiVCxd885sltyPwA57VEayGmZiEeFz3Ku6ERW9UP5HS61I+Pp8iYBbb6kOUayJoBoVGDdtIxaN7/I54Icn61pGb0i4ReOrrqCxJG5t3tTkEQKcGIVfK5CfhlVCgz5hW7lQiqhPWM3TOTJkWL08KQVM9hqJT1dtBFW+ei5+q/MO+wof1vxi3uQsdCH/VDCp9Ou3rpRN4szUfmsRxIIYBjVgYo2VZ9QZ7CWha48p+COMHwaqp4Hs1VDAnq426i762WbBQNxY2TeAdzXvN8nivv1n/Z4CM8sjLOh1dBlwcKNdZQ1jz9cs=----ATTACHMENT:----NDA2MDM2NjA0NTg1ODQwNSA1NjQwMTY0NjM5ODIwNDg5IDEzNTYwMjc2MjAzOTMyOTQ=