2011-09-08 17:02:40 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Gregwar\CaptchaBundle\DependencyInjection;
|
|
|
|
|
|
|
|
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
|
|
|
|
use Symfony\Component\Config\Definition\ConfigurationInterface;
|
|
|
|
|
|
|
|
class Configuration implements ConfigurationInterface
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Generates the configuration tree.
|
|
|
|
* @return TreeBuilder
|
|
|
|
*/
|
|
|
|
public function getConfigTreeBuilder()
|
|
|
|
{
|
|
|
|
$treeBuilder = new TreeBuilder();
|
|
|
|
$rootNode = $treeBuilder->root('gregwar_captcha', 'array');
|
2011-11-09 14:43:25 +01:00
|
|
|
|
2011-09-08 17:02:40 +02:00
|
|
|
$rootNode
|
2011-09-09 20:02:47 +02:00
|
|
|
->addDefaultsIfNotSet()
|
2011-09-08 17:02:40 +02:00
|
|
|
->children()
|
2011-09-09 20:02:47 +02:00
|
|
|
->scalarNode('length')->defaultValue(5)->end()
|
|
|
|
->scalarNode('width')->defaultValue(120)->end()
|
|
|
|
->scalarNode('height')->defaultValue(40)->end()
|
2011-12-02 18:41:16 +01:00
|
|
|
->scalarNode('charset')->defaultValue('abcdefhjkmnprstuvwxyz23456789')->end()
|
2011-11-09 14:43:25 +01:00
|
|
|
->scalarNode('as_file')->defaultValue(false)->end()
|
|
|
|
->scalarNode('image_folder')->defaultValue('captcha')->end()
|
|
|
|
->scalarNode('web_path')->defaultValue('%kernel.root_dir%/../web')->end()
|
2011-11-09 17:58:53 +01:00
|
|
|
->scalarNode('gc_freq')->defaultValue(100)->end()
|
|
|
|
->scalarNode('expiration')->defaultValue(60)->end()
|
2011-09-08 17:02:40 +02:00
|
|
|
->end()
|
|
|
|
;
|
|
|
|
return $treeBuilder;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|