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
20 * @package Drupal\Console\Core\Command\Exclude
22 class DrupliconCommand extends Command
36 * DrupliconCommand constructor.
37 * @param string $appRoot
38 * @param TwigRenderer $renderer
40 public function __construct(
42 TwigRenderer $renderer
44 $this->appRoot = $appRoot;
45 $this->renderer = $renderer;
46 parent::__construct();
52 protected function configure()
55 ->setName('druplicon')
56 ->setDescription($this->trans('application.commands.druplicon.description'));
62 protected function execute(InputInterface $input, OutputInterface $output)
64 $io = new DrupalStyle($input, $output);
67 '%s/templates/core/druplicon/',
68 $this->appRoot . DRUPAL_CONSOLE_CORE
71 $finder = new Finder();
77 foreach ($finder as $template) {
78 $templates[] = $template->getRelativePathname();
81 $druplicon = $this->renderer->render(
84 $templates[array_rand($templates)]
88 $io->writeln($druplicon);