Ejemplo n.º 1
0
 /**
  * Get the tree used for the application
  *
  * @return \Symfony\Component\Config\Definition\NodeInterface
  */
 public function getTree()
 {
     $treeBuilder = new \Symfony\Component\Config\Definition\Builder\TreeBuilder();
     $rootNode = $treeBuilder->root('phpmetrics');
     $rootNode->children()->arrayNode('rules')->useAttributeAsKey('rulename')->prototype('array')->children()->scalarNode('0')->end()->scalarNode('1')->end()->scalarNode('2')->end()->end()->end()->end()->scalarNode('failure')->defaultValue(null)->end()->arrayNode('path')->addDefaultsIfNotSet()->children()->scalarNode('directory')->defaultValue(null)->end()->scalarNode('exclude')->defaultValue('Tests|tests|Features|features|\\.svn|\\.git|vendor')->end()->scalarNode('extensions')->defaultValue('php|inc')->end()->booleanNode('symlinks')->defaultValue(false)->end()->end()->end()->booleanNode('ignore-errors')->defaultValue(false)->end()->arrayNode('logging')->addDefaultsIfNotSet()->children()->arrayNode('report')->children()->scalarNode('html')->defaultValue(null)->end()->scalarNode('xml')->defaultValue(null)->end()->scalarNode('csv')->defaultValue(null)->end()->scalarNode('json')->defaultValue(null)->end()->scalarNode('cli')->defaultValue(null)->end()->end()->end()->arrayNode('violations')->children()->scalarNode('xml')->defaultValue(null)->end()->end()->end()->arrayNode('chart')->children()->scalarNode('bubbles')->defaultValue(null)->end()->end()->end()->end()->end()->arrayNode('template')->addDefaultsIfNotSet()->children()->scalarNode('title')->defaultValue('PhpMetrics report')->end()->end()->end();
     return $treeBuilder->buildTree();
 }
Ejemplo n.º 2
0
 /**
  * @param array $config
  */
 function process(array $config)
 {
     $treeBuilder = new \Symfony\Component\Config\Definition\Builder\TreeBuilder();
     $rootNode = $treeBuilder->root('root', 'array');
     $root = $rootNode->children();
     $mail = $root->arrayNode('mail')->canBeEnabled()->addDefaultsIfNotSet()->children();
     $mail->scalarNode('to')->cannotBeEmpty()->isRequired()->end();
     $mail->scalarNode('subject')->cannotBeEmpty()->isRequired()->end();
     $mail->scalarNode('from')->cannotBeEmpty()->isRequired()->end();
     $processor = new \Symfony\Component\Config\Definition\Processor();
     return $processor->process($treeBuilder->buildTree(), ['root' => $config]);
 }
 public function getConfiguration()
 {
     $tb = new \Symfony\Component\Config\Definition\Builder\TreeBuilder();
     $tb->root('use_statement_fixes', 'array', new \Scrutinizer\PhpAnalyzer\Config\NodeBuilder())->canBeDisabled()->children()->booleanNode('remove_unused')->defaultTrue()->end()->booleanNode('preserve_multiple')->info('Whether you would like multiple imports in one USE statement to be preserved, e.g. ``use A, B;``.')->defaultFalse()->end()->booleanNode('order_alphabetically')->defaultFalse()->end()->end();
     return $tb;
 }
 public function getConfiguration()
 {
     $tb = new \Symfony\Component\Config\Definition\Builder\TreeBuilder();
     $tb->root('unreachable_code', 'array', new NodeBuilder())->attribute('label', 'Un-reachable Code')->canBeDisabled();
     return $tb;
 }
 public function getConfiguration()
 {
     $tb = new \Symfony\Component\Config\Definition\Builder\TreeBuilder();
     $tb->root('typo_checks', 'array', new NodeBuilder())->attribute('label', 'Check for Typos')->canBeDisabled();
     return $tb;
 }
Ejemplo n.º 6
0
#!/usr/bin/php
<?php 
$config = ['require_services' => ['sf_filesystem'], 'git_urls' => ['https://github.com/symfony/Config.git' => 'sf_config/'], 'autoload_config' => ['sf_config/' => 'Symfony\\Component\\Config'], 'example' => function () {
    $treeBuilder = new \Symfony\Component\Config\Definition\Builder\TreeBuilder();
    $rootNode = $treeBuilder->root('database');
    $rootNode->children()->enumNode('gender')->values(['male', 'female'])->end()->end();
    var_dump($treeBuilder);
}];
if ($return_config) {
    return $config;
}
require_once __DIR__ . '/_yf_autoloader.php';
new yf_autoloader($config);
 public function getConfiguration()
 {
     $tb = new \Symfony\Component\Config\Definition\Builder\TreeBuilder();
     $tb->root('dead_assignments', 'array', new NodeBuilder())->attribute('label', 'Dead Assignment Detection')->canBeDisabled();
     return $tb;
 }