protected function execute(InputInterface $input, OutputInterface $output)
 {
     $configArgument = $input->getArgument('config');
     if (false === file_exists($configArgument)) {
         throw new FileNotFoundException(sprintf('configuration file : "%s" can not be found', $configArgument));
     }
     $output->write('1 - Parse config file : ');
     $parser = new Parser();
     $config = $parser->parse(file_get_contents($configArgument));
     unset($parser);
     $output->writeln('<info>Ok</info>');
     $output->write('2 - Load Resolver and Generators : ');
     $processor = new Processor();
     $workerConfiguration = $processor->process($this->configurationTree->getWorkerTree(), ['root' => $config]);
     $generators = $this->generatorChain->getGenerators($workerConfiguration['generators']);
     $resolvers = $this->resolverChain->getResolvers($workerConfiguration['resolvers']);
     $output->writeln('<info>Ok</info>');
     $output->write('3 - Build configuration tree : ');
     foreach (array_merge($generators, $resolvers) as $worker) {
         if ($worker instanceof TreeConfiguratorInterface) {
             $this->configurationTree->addTreeConfigurator($worker);
         }
     }
     $output->writeln('<info>Ok</info>');
     $dumper = new YamlReferenceDumper();
     echo $dumper->dump($this->configurationTree);
 }
 public function testDumper()
 {
     $configuration = new ExampleConfiguration();
     $dumper = new YamlReferenceDumper();
     $this->markTestIncomplete('The Yaml Dumper currently does not support prototyped arrays');
     $this->assertEquals($this->getConfigurationAsString(), $dumper->dump($configuration));
 }
Ejemplo n.º 3
0
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $analyzerConfiguration = Analyzer\Factory::getPassesConfigurations();
     $configuration = new Configuration([], $analyzerConfiguration);
     $configTree = $configuration->getConfigTreeBuilder($analyzerConfiguration)->buildTree();
     $dumper = new YamlReferenceDumper();
     $output->writeln($dumper->dumpNode($configTree));
 }
Ejemplo n.º 4
0
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $output->writeln('<info># Default configuration for "Migraine"</info>');
     $dumper = new YamlReferenceDumper();
     $contents = '';
     $node = $this->getConfiguration()->getConfigTreeBuilder()->buildTree();
     foreach ($node->getChildren() as $childNode) {
         $contents .= $dumper->dumpNode($childNode);
     }
     $output->writeln($contents);
 }
Ejemplo n.º 5
0
 /**
  * @param string $gadget
  * @return string
  * @throws \Exception
  */
 public function dump($gadget = null)
 {
     /** @var ArrayNode $tree */
     $node = (new TreeFactory())->createTree($this->repository);
     if ($gadget) {
         $children = $node->getChildren();
         if (!isset($children[$gadget])) {
             throw new \Exception(sprintf('gadget "%s" not exists', $gadget));
         }
         $node = $children[$gadget];
     }
     $dumper = new YamlReferenceDumper();
     return $dumper->dumpNode($node);
 }
Ejemplo n.º 6
0
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     if (file_exists(Configuration::NAME) && $input->getOption('force') === false) {
         $output->writeln('<error>Configuration file already exists.</error>');
         $output->writeln('<comment>To overwrite it use `--force` option.</comment>');
         return;
     }
     $contents = '';
     $dumper = new YamlReferenceDumper();
     $node = $this->getConfiguration()->getConfigTreeBuilder()->buildTree();
     foreach ($node->getChildren() as $childNode) {
         $contents .= $dumper->dumpNode($childNode);
     }
     file_put_contents(Configuration::NAME, trim($contents));
     $output->writeln('<info>Configuration file created successfully!</info>');
 }
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $configuration = new TypesGeneratorConfiguration();
     $dumper = new YamlReferenceDumper();
     $output->writeln($dumper->dump($configuration));
 }
Ejemplo n.º 8
0
 public function testDumper()
 {
     $configuration = new ExampleConfiguration();
     $dumper = new YamlReferenceDumper();
     $this->assertEquals($this->getConfigurationAsString(), $dumper->dump($configuration));
 }
Ejemplo n.º 9
0
 /**
  * Writes the formatted configuration to the output manager.
  *
  * @param OutputInterface        $output        The output manager.
  * @param string                 $format        The output format.
  * @param ConfigurationInterface $configuration The configuration.
  *
  * @throws InvalidArgumentException If the format is not supported.
  */
 protected function writeConfiguration(OutputInterface $output, $format, ConfigurationInterface $configuration)
 {
     switch ($format) {
         case 'xml':
             $dumper = new XmlReferenceDumper();
             $helper = $this->getHelper('xml');
             break;
         case 'yaml':
             $dumper = new YamlReferenceDumper();
             $helper = $this->getHelper('yaml');
             break;
             // @codeCoverageIgnoreStart
         // @codeCoverageIgnoreStart
         default:
             throw new InvalidArgumentException("The format \"{$format}\" is not supported.");
     }
     // @codeCoverageIgnoreEnd
     $output->write($helper->colorize($dumper->dump($configuration)));
 }
Ejemplo n.º 10
0
 public function dumpConfiguration()
 {
     $dumper = new YamlReferenceDumper($this->importer);
     $string = '';
     $string .= $dumper->dump($this->getImporterByName('workspace_properties'));
     $string .= $dumper->dump($this->getImporterByName('owner'));
     $string .= $dumper->dump($this->getImporterByName('user'));
     $string .= $dumper->dump($this->getImporterByName('groups'));
     $string .= $dumper->dump($this->getImporterByName('roles'));
     $string .= $dumper->dump($this->getImporterByName('tools'));
     $string .= $dumper->dump($this->getImporterByName('forum'));
     return $string;
 }