for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* This file is part of the Mediapart Selligent Client API
*
* CC BY-NC-SA <https://github.com/mediapart/selligent>
* For the full license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Mediapart\Selligent;
use Symfony\Component\Config\Definition\ConfigurationInterface;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Yaml\Yaml;
use Symfony\Component\Config\Definition\Processor;
* Class Configuration
* @package Mediapart\Selligent
class Configuration implements ConfigurationInterface
{
* Define configTree
* @return TreeBuilder
public function getConfigTreeBuilder()
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root('selligent');
$rootNode
->children()
->scalarNode('login')
->isRequired()
->cannotBeEmpty()
->end()
->scalarNode('password')
->scalarNode('namespace')
->defaultValue('http://tempuri.org/')
->scalarNode('wsdl')
->scalarNode('list')
->arrayNode('options')
->arrayNode('classmap')
->prototype('scalar')
;
return $treeBuilder;
}
* load, validate and return configuration
* @param string $configFile
* @return array
public function loadConfig($configFile)
$config = Yaml::parse($configFile);
$processor = new Processor();
$processedConfiguration = $processor->processConfiguration(
new Configuration(),
$config
);
return $processedConfiguration;