| 199 |
lars |
1 |
<?php namespace Clockwork\Support\Symfony;
|
|
|
2 |
|
|
|
3 |
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
|
|
|
4 |
use Symfony\Component\Config\Definition\ConfigurationInterface;
|
|
|
5 |
use Symfony\Component\HttpKernel\Kernel;
|
|
|
6 |
|
|
|
7 |
class ClockworkConfiguration implements ConfigurationInterface
|
|
|
8 |
{
|
|
|
9 |
protected $debug;
|
|
|
10 |
|
|
|
11 |
public function __construct($debug)
|
|
|
12 |
{
|
|
|
13 |
$this->debug = $debug;
|
|
|
14 |
}
|
|
|
15 |
|
|
|
16 |
public function getConfigTreeBuilder()
|
|
|
17 |
{
|
|
|
18 |
return $this->getConfigRoot()
|
|
|
19 |
->children()
|
|
|
20 |
->booleanNode('enable')->defaultValue($this->debug)->end()
|
|
|
21 |
->variableNode('web')->defaultValue(true)->end()
|
|
|
22 |
->booleanNode('authentication')->defaultValue(false)->end()
|
|
|
23 |
->scalarNode('authentication_password')->defaultValue('VerySecretPassword')->end()
|
|
|
24 |
->end()
|
|
|
25 |
->end();
|
|
|
26 |
}
|
|
|
27 |
|
|
|
28 |
protected function getConfigRoot()
|
|
|
29 |
{
|
|
|
30 |
if (Kernel::VERSION_ID < 40300) {
|
|
|
31 |
return (new TreeBuilder)->root('clockwork');
|
|
|
32 |
}
|
|
|
33 |
|
|
|
34 |
return (new TreeBuilder('clockwork'))->getRootNode();
|
|
|
35 |
}
|
|
|
36 |
}
|