dumpNode() public method

public dumpNode ( Symfony\Component\Config\Definition\NodeInterface $node )
$node Symfony\Component\Config\Definition\NodeInterface
コード例 #1
0
ファイル: DumpReferenceCommand.php プロジェクト: ovr/phpsa
 /**
  * {@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));
 }
コード例 #2
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);
 }
コード例 #3
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);
 }
コード例 #4
0
ファイル: InitCommand.php プロジェクト: jiabin/migraine
 /**
  * {@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>');
 }