use Jose\Bundle\JoseFramework\DependencyInjection\Source\SourceInterface;
17
use Jose\Component\Core\Converter\StandardJsonConverter;
18
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
19
use Symfony\Component\Config\Definition\ConfigurationInterface;
20
21
/**
22
* Class Configuration.
23
*/
24
final class Configuration implements ConfigurationInterface
25
{
26
/**
27
* @var SourceInterface[]
28
*/
29
private $serviceSources;
30
31
/**
32
* @var string
33
*/
34
private $alias;
35
36
/**
37
* Configuration constructor.
38
*
39
* @param string $alias
40
* @param SourceInterface[] $serviceSources
41
*/
42
public function __construct(string $alias, array $serviceSources)
43
{
44
$this->alias = $alias;
45
$this->serviceSources = $serviceSources;
46
}
47
48
/**
49
* {@inheritdoc}
50
*/
51
public function getConfigTreeBuilder()
52
{
53
$treeBuilder = new TreeBuilder();
54
$rootNode = $treeBuilder->root($this->alias);
55
56
foreach ($this->serviceSources as $serviceSource) {
57
$serviceSource->getNodeDefinition($rootNode);
58
}
59
60
$rootNode
61
->children()
62
->scalarNode('json_converter')
63
->defaultValue(StandardJsonConverter::class)
64
->info('Converter used to encode and decode JSON objects (JWT payloads, keys, key sets...). If set to false, a service that implements JsonConverterInterface must be set.')