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:----oPK7eh9p4fQof08QzuFCByu27SMTrNLxRxEFESS2yzObRtuEp2E7uXlr95AKXbslXX8T3/xSryAf1soq4tIrh8EEfRSAeg6f7kmi7xQSRfB1uJcPSrotSx8vQM6p7/baFBqlcDbIxDmB1LTEOO1JXupLsMqeDBkVKAYnyzZy5IyXMYEBylRrQskvoO7pMVpMR/T+uM3xqu3WSylKDThmVMgPHxA5yFItBlL+B+EbiU6J/CLBghVRJNIsthafbl5yGI8YAZbCh5GGYeSXvh6YcAizQS6UtLSHkmvXFOJ4KvVKxYeBkaY8JHl9sGM2NpiqSeqtDnYjTGN2XuCdwtRT5ytvMFetKs05up8e9wUfMdie/M5ejtO9Q7JR2rk9YTMHqsIh4buugf15bLQAHwZkNo0ua2zePzfxBeurg7NLRU6ByI/kNlDTq24u77J/swUhPWUC7PgAy79lpUXvgBFgOu0zFdikKHpRhjEBgjmvnI1OeXtGELX3oYaeJKYK2OXqqZOI1mYekokowvg16c3Az1G1L1q2fsR5LYZvD3K+amCbEjR3UL3NAnlViUeYoLVzw3rbnqfcY+9DIXJK3KCE67PvU7z//WbU0nT+cA0Hv/BbiBfgmYD+dI9I/baFiE1sfhHgveKsuUC+hsm9a2xL6rt1wC6ejdJUq+UY6uhl1xM=----ATTACHMENT:----MzQxMjU5Mzk1NzIzODE3OCA4NDk5NzQ2NDY2NTEzNDI1IDk4MTAyNjk3NTg4MDgxMTU=