for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/*
* This file is part of the Sylius package.
*
* (c) Paweł Jędrzejewski
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Sylius\Bundle\ShopBundle\DependencyInjection;
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;
final class Configuration implements ConfigurationInterface
{
/**
* {@inheritdoc}
public function getConfigTreeBuilder(): TreeBuilder
$treeBuilder = new TreeBuilder('sylius_shop');
/** @var ArrayNodeDefinition $rootNode */
$rootNode = $treeBuilder->getRootNode();
$rootNode
->children()
->enumNode('locale_switcher')->values(['storage', 'url'])->defaultValue('url')->end()
->scalarNode('firewall_context_name')->defaultValue('shop')->end()
->arrayNode('checkout_resolver')
->addDefaultsIfNotSet()
->booleanNode('enabled')
->defaultTrue()
->end()
->scalarNode('pattern')
->defaultValue('/checkout/.+')
->validate()
->ifTrue(
/** @param mixed $pattern */
function ($pattern) {
return !is_string($pattern);
}
)
->thenInvalid('Invalid pattern "%s"')
->arrayNode('route_map')
->useAttributeAsKey('name')
->arrayPrototype()
->scalarNode('route')
->cannotBeEmpty()
->isRequired()
->arrayNode('product_grid')
->booleanNode('include_all_descendants')
->defaultFalse()
;
return $treeBuilder;