for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types = 1);
namespace Mikemirten\Bundle\JsonApiBundle\DependencyInjection;
use Symfony\Component\Config\Definition\Builder\NodeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
/**
* Class JsonApiConfiguration
*
* @package Mikemirten\Bundle\JsonApiBundle\DependencyInjection
*/
class JsonApiConfiguration implements ConfigurationInterface
{
* {@inheritdoc}
public function getConfigTreeBuilder()
$builder = new TreeBuilder();
$children = $builder->root(JsonApiExtension::ALIAS)->children();
$this->processMappers($children);
$this->processClients($children);
return $builder;
}
* Process mappers
* @param NodeBuilder $builder
protected function processMappers(NodeBuilder $builder): void
$builder->arrayNode('mappers')
->defaultValue(['default' => [
'handlers' => [
'attribute',
'relationship',
'link'
]
]])
->prototype('array')
->children()
->arrayNode('handlers')
->prototype('scalar');
* Process http-clients
protected function processClients(NodeBuilder $builder): void
$children = $builder->arrayNode('http_clients')
->scalarNode('base_url')
->isRequired()
->cannotBeEmpty()
->end()
->arrayNode('decorators')
->prototype('scalar')
->end();
$this->processEndpoints($children);
* Process endpoints of client
protected function processEndpoints(NodeBuilder $builder): void
$builder->arrayNode('resources')
->scalarNode('path')
->arrayNode('methods')
->children();