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:----ezB1DRztiEn2kd6nX1rPsDSqOeknRKNggA28pQ7VXQ/1f+w0rBquhdKW4FtqrvmNDvg0BhGzKiyt7TQlC3EwoTgzmeuqq9Bsvi89nLeFyWFy1V1/oxk3VwZv8WegxaKUVGTElss5zVZeRkQOJFZVGp5KxKvwI6yQhVL/hOX09v49w0JOjqXs1RdKR3pVIQMGdCU67jXkMjKZLhl4cVK+i4aDJRk+aJhjrodNEUGpoAf6wy79geDP71wfDdkL0jLoMwH1zFfOvRMtMHQ0qv3NhI/lVFyY+LtpFqCToh3qHlswJL7RcoZdBHpTHiQQGOlvfdAdvgCyvU+M2Rm5i3xYzY+UPySQmO2QeJfswZOed5cULnY5VJXeyG2U9PPQPMzroJnKn+0Dk/RDo4T/fX0xXVKlWdP56skGOgR9e1YwKNP2fXIEtrp/Ya5/MEgw8FV+JylBkzjd88ZQ5CG1M2plUxvRNxMjgw/506grZhNcN2BLp7qpRSuD/elCjv3A3kUsUpeVT9GVyMNp4TZV1AVIrtZvCRhrjPoUcMrh59PrAoQJdlrXdz6W+8QX6Z++BGA2L6WytNMHYItIlqXAETOv6sawc8IrwbwX94gYUBD/XWB7/Me9tY5byCHk+DVqFaEHlhSDg9n2V4aMF5xxpNhEGCULiwQrTFtcZ3iPCyhHnxI=----ATTACHMENT:----NTkzOTg1MjI5NDU4MTExMyAzNjA2OTMwNTQ0NzMwODM2IDQwOTExMjk5MzE2NTk0ODE=