for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/*
* This file is part of the SimpleSerializerBundle package.
*
* Copyright (c) 2012 Farheap Solutions (http://www.farheap.com)
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Opensoft\Bundle\SimpleSerializerBundle\DependencyInjection;
use Symfony\Component\Config\Definition\Builder\NodeBuilder;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;
class Configuration implements ConfigurationInterface
{
/***
* @var bool
private $debug;
/**
* @param bool $debug
public function __construct($debug = false)
$this->debug = $debug;
}
public function getConfigTreeBuilder()
$tb = new TreeBuilder();
$root = $tb
->root('opensoft_simple_serializer', 'array')
->children()
;
$this->addMetadataSection($root);
return $tb;
private function addMetadataSection(NodeBuilder $builder)
$builder
->arrayNode('metadata')
->addDefaultsIfNotSet()
->fixXmlConfig('directory', 'directories')
->scalarNode('cache')->defaultValue('file')->end()
->booleanNode('debug')->defaultValue($this->debug)->end()
->arrayNode('file_cache')
->scalarNode('dir')->defaultValue('%kernel.cache_dir%/simple-serializer')->end()
->end()
->booleanNode('auto_detection')->defaultTrue()->end()
->arrayNode('directories')
->prototype('array')
->scalarNode('path')->isRequired()->end()
->scalarNode('namespace_prefix')->defaultValue('')->end()