Repository.php 2.45 KiB
<?php declare(strict_types=1);
/*
 * This file is part of "irstea/make-shim".
 * (c) 2019 Irstea <dsi.poleis@irstea.fr>
 * For the full copyright and license information, please view the LICENSE.md
 * file that was distributed with this source code.
 */
namespace Irstea\MakeShim\Configuration\Phive;
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;
/**
 * Class Repository.
class Repository implements ConfigurationInterface
    /**
     * {@inheritdoc}
    public function getConfigTreeBuilder()
        $treeBuilder = new TreeBuilder('repository');
        /** @var ArrayNodeDefinition $rootNode */
        $rootNode = $treeBuilder->getRootNode();
        $rootNode
            ->fixXmlConfig('phar')
            ->children()
                ->arrayNode('phars')
                    ->useAttributeAsKey('name', false)
                    ->arrayPrototype()
                        ->fixXmlConfig('release')
                        ->children()
                            ->scalarNode('name')->isRequired()->end()
                            ->arrayNode('releases')
                                ->useAttributeAsKey('version', false)
                                ->arrayPrototype()
                                    ->children()
                                        ->scalarNode('version')->isRequired()->end()
                                        ->scalarNode('url')->isRequired()->end()
                                        ->arrayNode('signature')
                                            ->children()
                                                ->scalarNode('type')->end()
                                            ->end()
                                        ->end()
                                        ->arrayNode('hash')
                                            ->children()
                                                ->scalarNode('type')->end()
                                                ->scalarNode('value')->end()
                                            ->end()
                                        ->end()
                                    ->end()
                                ->end()
                            ->end()
                        ->end()
                    ->end()
                ->end()
            ->end();
        return $treeBuilder;