webnet-fr /
database-anonymizer-bundle
| 1 | <?php |
||||
| 2 | |||||
| 3 | namespace WebnetFr\DatabaseAnonymizerBundle\DependencyInjection; |
||||
| 4 | |||||
| 5 | use Symfony\Component\Config\Definition\Builder\TreeBuilder; |
||||
| 6 | use Symfony\Component\Config\Definition\ConfigurationInterface; |
||||
| 7 | use WebnetFr\DatabaseAnonymizer\Config\ConfigurationTrait; |
||||
| 8 | |||||
| 9 | /** |
||||
| 10 | * @author Vlad Riabchenko <[email protected]> |
||||
| 11 | */ |
||||
| 12 | class Configuration implements ConfigurationInterface |
||||
| 13 | { |
||||
| 14 | use ConfigurationTrait; |
||||
| 15 | |||||
| 16 | /** |
||||
| 17 | * @inheritdoc |
||||
| 18 | */ |
||||
| 19 | public function getConfigTreeBuilder() |
||||
| 20 | { |
||||
| 21 | $treeBuilder = new TreeBuilder('webnet_fr_database_anonymizer'); |
||||
| 22 | |||||
| 23 | $connectionsRootNode = (new TreeBuilder('connections'))->getRootNode(); |
||||
| 24 | $node = $connectionsRootNode |
||||
| 25 | ->requiresAtLeastOneElement() |
||||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||||
| 26 | ->useAttributeAsKey('name') |
||||
| 27 | ->prototype('array'); |
||||
| 28 | |||||
| 29 | $this->configureAnonymizer($node); |
||||
| 30 | |||||
| 31 | $treeBuilder->getRootNode() |
||||
| 32 | ->beforeNormalization() |
||||
| 33 | ->ifTrue(static function ($v) { |
||||
| 34 | return is_array($v) && !array_key_exists('connections', $v); |
||||
| 35 | }) |
||||
| 36 | ->then(static function ($v) { |
||||
| 37 | $connection = []; |
||||
| 38 | foreach ($v as $key => $value) { |
||||
| 39 | $connection[$key] = $v[$key]; |
||||
| 40 | unset($v[$key]); |
||||
| 41 | } |
||||
| 42 | |||||
| 43 | $v['connections'] = ['default' => $connection]; |
||||
| 44 | |||||
| 45 | return $v; |
||||
| 46 | }) |
||||
| 47 | ->end() |
||||
| 48 | ->append($connectionsRootNode); |
||||
|
0 ignored issues
–
show
The method
append() does not exist on Symfony\Component\Config...\Builder\NodeDefinition. It seems like you code against a sub-type of Symfony\Component\Config...\Builder\NodeDefinition such as Symfony\Component\Config...der\ArrayNodeDefinition.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||
| 49 | |||||
| 50 | return $treeBuilder; |
||||
| 51 | } |
||||
| 52 | } |
||||
| 53 |