for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/*
* The MIT License (MIT)
*
* Copyright (c) 2014-2015 Spomky-Labs
* This software may be modified and distributed under the terms
* of the MIT license. See the LICENSE file for details.
*/
namespace SpomkyLabs\JoseBundle\DependencyInjection;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;
final class Configuration implements ConfigurationInterface
{
private $alias;
/**
* @param string $alias
public function __construct($alias)
$this->alias = $alias;
}
* {@inheritdoc}
public function getConfigTreeBuilder()
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root($this->alias);
$rootNode
->children()
->scalarNode('server_name')->cannotBeEmpty()->defaultValue('OAuth2 Server')->end()
->arrayNode('compression_methods')->prototype('scalar')->end()->treatNullLike([])->end()
->arrayNode('storage')
->addDefaultsIfNotSet()
->validate()
->ifTrue(function ($value) {
return true === $value['enabled'] && null !== $value['class'] && !class_exists($value['class']);
})
->thenInvalid('The class does not exist')
->end()
->booleanNode('enabled')
->defaultFalse()
->scalarNode('manager')
->defaultValue('jose.jot_manager.default')
->cannotBeEmpty()
->scalarNode('class')
->defaultNull()
->end();
return $treeBuilder;