2012-04-12 20:34:19 +02:00
|
|
|
<?php
|
|
|
|
|
2012-04-13 11:03:05 +02:00
|
|
|
/*
|
|
|
|
* This file is part of the NelmioApiDocBundle.
|
|
|
|
*
|
|
|
|
* (c) Nelmio <hello@nelm.io>
|
|
|
|
*
|
|
|
|
* For the full copyright and license information, please view the LICENSE
|
|
|
|
* file that was distributed with this source code.
|
|
|
|
*/
|
|
|
|
|
2012-04-13 10:05:32 +02:00
|
|
|
namespace Nelmio\ApiDocBundle\DependencyInjection;
|
2012-04-12 20:34:19 +02:00
|
|
|
|
|
|
|
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
|
|
|
|
use Symfony\Component\Config\Definition\ConfigurationInterface;
|
|
|
|
|
|
|
|
class Configuration implements ConfigurationInterface
|
|
|
|
{
|
|
|
|
public function getConfigTreeBuilder()
|
|
|
|
{
|
|
|
|
$treeBuilder = new TreeBuilder();
|
|
|
|
$treeBuilder
|
|
|
|
->root('nelmio_api_doc')
|
|
|
|
->children()
|
|
|
|
->scalarNode('name')->defaultValue('API documentation')->end()
|
2012-10-17 17:12:36 +04:00
|
|
|
->booleanNode('on_demand')->defaultTrue()->end()
|
2012-07-18 13:18:26 +02:00
|
|
|
->arrayNode('sandbox')
|
|
|
|
->addDefaultsIfNotSet()
|
|
|
|
->children()
|
|
|
|
->scalarNode('enabled')->defaultTrue()->end()
|
|
|
|
->scalarNode('endpoint')->defaultValue('/app_dev.php')->end()
|
2012-08-10 13:55:35 +02:00
|
|
|
->arrayNode('authentication')
|
|
|
|
->children()
|
|
|
|
->scalarNode('name')->isRequired()->end()
|
|
|
|
->scalarNode('delivery')
|
|
|
|
->isRequired()
|
|
|
|
->validate()
|
|
|
|
// header|query|request, but only query is implemented for now
|
|
|
|
->ifNotInArray(array('query'))
|
|
|
|
->thenInvalid("Unknown authentication delivery type '%s'.")
|
|
|
|
->end()
|
|
|
|
->end()
|
|
|
|
->end()
|
|
|
|
->end()
|
2012-07-18 13:18:26 +02:00
|
|
|
->end()
|
|
|
|
->end()
|
2012-05-24 01:22:45 +02:00
|
|
|
->end();
|
2012-04-12 20:34:19 +02:00
|
|
|
|
|
|
|
return $treeBuilder;
|
|
|
|
}
|
|
|
|
}
|