Security update for permissions_by_term
[yaffs-website] / vendor / behat / behat / src / Behat / Behat / Translator / Cli / GherkinTranslationsController.php
1 <?php
2
3 /*
4  * This file is part of the Behat.
5  * (c) Konstantin Kudryashov <ever.zet@gmail.com>
6  *
7  * For the full copyright and license information, please view the LICENSE
8  * file that was distributed with this source code.
9  */
10
11 namespace Behat\Behat\Translator\Cli;
12
13 use Behat\Testwork\Cli\Controller;
14 use Symfony\Component\Console\Command\Command as SymfonyCommand;
15 use Symfony\Component\Console\Input\InputInterface;
16 use Symfony\Component\Console\Output\OutputInterface;
17 use Symfony\Component\Translation\Translator;
18
19 /**
20  * Configures translator service and loads default translations.
21  *
22  * @author Konstantin Kudryashov <ever.zet@gmail.com>
23  */
24 final class GherkinTranslationsController implements Controller
25 {
26     /**
27      * @var Translator
28      */
29     private $translator;
30
31     /**
32      * Initializes controller.
33      *
34      * @param Translator $translator
35      */
36     public function __construct(Translator $translator)
37     {
38         $this->translator = $translator;
39     }
40
41     /**
42      * {@inheritdoc}
43      */
44     public function configure(SymfonyCommand $command)
45     {
46     }
47
48     /**
49      * {@inheritdoc}
50      */
51     public function execute(InputInterface $input, OutputInterface $output)
52     {
53         $i18nPath = dirname(dirname(dirname(dirname(dirname(__DIR__))))) . DIRECTORY_SEPARATOR . 'i18n.php';
54
55         foreach (require($i18nPath) as $lang => $messages) {
56             $this->translator->addResource('array', $messages, $lang, 'output');
57         }
58     }
59 }