Skip to content

Instantly share code, notes, and snippets.

@pjedrzejewski
Created September 18, 2011 15:49
Show Gist options
  • Save pjedrzejewski/1225191 to your computer and use it in GitHub Desktop.
Save pjedrzejewski/1225191 to your computer and use it in GitHub Desktop.
Symfony2 configuration processor, gist #2.
<?php
/*
* This file is part of the Sylius package.
*
* (c) Paweł Jędrzejewski
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Sylius\Bundle\ThemingBundle\Packager;
use Symfony\Component\Config\Definition\ConfigurationInterface;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
/**
* Theme pack configuration.
*
* @author Paweł Jędrzejewski <[email protected]>
*/
class Configuration implements ConfigurationInterface
{
public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root('theme');
$rootNode
->addDefaultsIfNotSet()
->children()
->scalarNode('name')->isRequired()->cannotBeEmpty()->end()
->scalarNode('version')->isRequired()->cannotBeEmpty()->end()
->scalarNode('description')->defaultValue('...')->end()
->end();
return $treeBuilder;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment