5 * Contains \Drupal\Console\Core\Command\Exclude\DrupliconCommand.
8 namespace Drupal\Console\Core\Command\Exclude;
10 use Symfony\Component\Console\Input\InputInterface;
11 use Symfony\Component\Console\Output\OutputInterface;
12 use Symfony\Component\Console\Command\Command;
13 use Symfony\Component\Finder\Finder;
14 use Drupal\Console\Core\Command\Shared\CommandTrait;
15 use Drupal\Console\Core\Utils\TwigRenderer;
16 use Drupal\Console\Core\Style\DrupalStyle;
19 * Class DrupliconCommand
21 * @package Drupal\Console\Core\Command\Exclude
23 class DrupliconCommand extends Command
37 * DrupliconCommand constructor.
39 * @param string $appRoot
40 * @param TwigRenderer $renderer
42 public function __construct(
44 TwigRenderer $renderer
46 $this->appRoot = $appRoot;
47 $this->renderer = $renderer;
48 parent::__construct();
54 protected function configure()
57 ->setName('druplicon')
58 ->setDescription($this->trans('application.commands.druplicon.description'));
64 protected function execute(InputInterface $input, OutputInterface $output)
66 $io = new DrupalStyle($input, $output);
69 '%s/templates/core/druplicon/',
70 $this->appRoot . DRUPAL_CONSOLE_CORE
73 $finder = new Finder();
79 foreach ($finder as $template) {
80 $templates[] = $template->getRelativePathname();
83 $druplicon = $this->renderer->render(
86 $templates[array_rand($templates)]
90 $io->writeln($druplicon);