5 * Contains \Drupal\Console\Core\Command\Exclude\ElephpantCommand.
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 ElephpantCommand
21 * @package Drupal\Console\Core\Command\Exclude
23 class ElephpantCommand extends Command
38 * DrupliconCommand constructor.
40 * @param string $appRoot
41 * @param TwigRenderer $renderer
43 public function __construct(
45 TwigRenderer $renderer
47 $this->appRoot = $appRoot;
48 $this->renderer = $renderer;
49 parent::__construct();
55 protected function configure()
58 ->setName('elephpant')
59 ->setDescription($this->trans('application.commands.elephpant.description'));
65 protected function execute(InputInterface $input, OutputInterface $output)
67 $io = new DrupalStyle($input, $output);
70 '%stemplates/core/elephpant/',
71 $this->appRoot . DRUPAL_CONSOLE_CORE
74 $finder = new Finder();
81 foreach ($finder as $template) {
82 $templates[] = $template->getRelativePathname();
85 $elephpant = $this->renderer->render(
88 $templates[array_rand($templates)]
92 $io->writeln($elephpant);