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:----fY345C08mMCvzmfdp9eu3k4TbdV3QEJyNuS8xiBNKPbtWdpS6yE5mhIa4oL/8dvGxDW8bP+Pq9rpBW8R1//l6G+u9P/IUmGz/cI5iiMI+z6lZcq73SuCoFLUMkja4q4d0bvmQljHAGnepAKiiR8jaKI4eWKWxe6MVUrNLw6B+rXYkCf6KFEagfpMk6LCROvnP8zxBfAyJAK8RRBocE/hhLr8aNKt0+MrP7jyOwDoNhIdUG4m6Jt34edlyRT1DV9Ue6TE0/oC50D788u2OkU9CO8FmqKMbod+xJstdW1FIlAY7eCS0kXSsauzYLYjRlPk65KrAAiHupfM5jDssYcORzeQm0q3P3yYaQ1IN5q/Wk7BULo/q16OSwXvth7Zs1YrkNH628ege+fvnnYOSBohW5P5Gw3vPkV+bSgjukn58P+PRxZa5hfqIJtpKAU0YaPtFrXGOsmi4wh4jsi36GxhT/XIlnvIpvzDp3E+JK5uizadCv/c5udouOYxSQOF7OeGOmQQujIC1ne/kklZir2yjazdnd7hr8/49o6NV0lKNC30L98IQCvOR/ey+42VbRz/Gbs3bf0aqdPMnRbLXNlwgnUrn9rCppdm9pxtmcHWcYvfQmsVaGFYJOITnD5MC8Ipr1DmGmwCWNIfRi/1SMfTJ/LRK/EHQRub4qGaBs8FoJ0=----ATTACHMENT:----MTIzMjIyNzUyNTYxNTgxNyA1NzAzNzMyNjA0MTA0OTA5IDE0Nzc1NjAyNjI1MjQ5NjA=