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\Finder\Finder;
13 use Drupal\Console\Core\Command\Command;
14 use Drupal\Console\Core\Utils\TwigRenderer;
15 use Drupal\Console\Core\Utils\ConfigurationManager;
18 * Class ElephpantCommand
20 * @package Drupal\Console\Core\Command\Exclude
22 class ElephpantCommand extends Command
35 * @var ConfigurationManager
37 protected $configurationManager;
41 * ElephpantCommand constructor.
43 * @param string $appRoot
44 * @param TwigRenderer $renderer
45 * @param ConfigurationManager $configurationManager
47 public function __construct(
49 TwigRenderer $renderer,
50 ConfigurationManager $configurationManager
52 $this->appRoot = $appRoot;
53 $this->renderer = $renderer;
54 $this->configurationManager = $configurationManager;
55 parent::__construct();
61 protected function configure()
64 ->setName('elephpant')
65 ->setDescription($this->trans('application.commands.elephpant.description'));
71 protected function execute(InputInterface $input, OutputInterface $output)
74 '%stemplates/core/elephpant/',
75 $this->configurationManager->getVendorCoreRoot()
78 $finder = new Finder();
85 foreach ($finder as $template) {
86 $templates[] = $template->getRelativePathname();
89 $elephpant = $this->renderer->render(
92 $templates[array_rand($templates)]
96 $this->getIo()->writeln($elephpant);