X-Git-Url: http://www.aleph1.co.uk/gitweb/?a=blobdiff_plain;ds=sidebyside;f=vendor%2Fdrupal%2Fconsole-core%2Fsrc%2FCommand%2FExclude%2FElephpantCommand.php;fp=vendor%2Fdrupal%2Fconsole-core%2Fsrc%2FCommand%2FExclude%2FElephpantCommand.php;h=0afc814903f9423482a98fc9164a1422ef205071;hb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;hp=0000000000000000000000000000000000000000;hpb=57c063afa3f66b07c4bbddc2d6129a96d90f0aad;p=yaffs-website diff --git a/vendor/drupal/console-core/src/Command/Exclude/ElephpantCommand.php b/vendor/drupal/console-core/src/Command/Exclude/ElephpantCommand.php new file mode 100644 index 000000000..0afc81490 --- /dev/null +++ b/vendor/drupal/console-core/src/Command/Exclude/ElephpantCommand.php @@ -0,0 +1,93 @@ +appRoot = $appRoot; + $this->renderer = $renderer; + parent::__construct(); + } + + /** + * {@inheritdoc} + */ + protected function configure() + { + $this + ->setName('elephpant') + ->setDescription($this->trans('application.commands.elephpant.description')); + } + + /** + * {@inheritdoc} + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + $io = new DrupalStyle($input, $output); + + $directory = sprintf( + '%stemplates/core/elephpant/', + $this->appRoot . DRUPAL_CONSOLE_CORE + ); + + $finder = new Finder(); + $finder->files() + ->name('*.twig') + ->in($directory); + + $templates = []; + + foreach ($finder as $template) { + $templates[] = $template->getRelativePathname(); + } + + $elephpant = $this->renderer->render( + sprintf( + 'core/elephpant/%s', + $templates[array_rand($templates)] + ) + ); + + $io->writeln($elephpant); + return 0; + } +}