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:----zQfeuNuOkgEq/lNd0Nq8/wMzmioLUFNZXkwt13w95AEhcmUUWnSEPNrZMjWgVHop1cd+9VAksrshDjalBpjcsCrk9tlwL2cfWdF9YlWzE6y/yS05HDFIdaRkcp1oZaA3+z6hRQDOWYVhJcpPLPRquRBrd+B8dKb/BUJtboo+jgDt40xeaUjHthBZAeX0i2pTomDlignxC5wd6QOyTazrmbxQVmld0zlTU9MBoiKnbd7wS+vdMfQ9t7WWMhf8HT0TEoxnr3F8xFQY93t27FQUtRY+84wCpj9cdvH93vCIF/f4DC1uCY2EYeW08DbHbnAix9Cdkk3CBF11bVuYVA8/IElyEpEnlukVs8Q45SfWW/ItlAWetwh7Z7xRMcx/WOINwjM/WZAP/Tqr3zd+qC065+BYWYirEkZJLDnLGHXQ5UZ3xNvB9ArtR5BFUpCzrOkeCM9AkovxbogeYcFpY1PCtObnNMYXGr89pmPu7yCDnjRVFBW7PhHgmO1jWkI8KGOaB7NqCTGmBMxsW+daMqZ2bi2Ktoo0Oe4r7u2GFLMjzXQAisCexp04+17z2JPgDWD/BiC5kahpvGEqB8A0KarvXxPsErenS3mugrUBaDfefQlEg1R6Rplzd5+JK4WkgT7qkPj/mVuRVGYCPjpfgEEvEvkziuAzzV2LK33jfvusyWY=----ATTACHMENT:----MTE3OTU2NjMzMDc0NzM3IDE2NzIwMzM2ODE3NTQ3NTUgNDI5OTE5MDI1NzE1MDgyMQ==