eloyekunle /
PermissionsBundle
| 1 | <?php |
||||
| 2 | |||||
| 3 | /* |
||||
| 4 | * This file is part of the EloyekunlePermissionsBundle package. |
||||
| 5 | * |
||||
| 6 | * (c) Elijah Oyekunle <https://elijahoyekunle.com/> |
||||
| 7 | * |
||||
| 8 | * For the full copyright and license information, please view the LICENSE |
||||
| 9 | * file that was distributed with this source code. |
||||
| 10 | */ |
||||
| 11 | |||||
| 12 | namespace Eloyekunle\PermissionsBundle\DependencyInjection; |
||||
| 13 | |||||
| 14 | use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition; |
||||
| 15 | use Symfony\Component\Config\Definition\Builder\TreeBuilder; |
||||
| 16 | use Symfony\Component\Config\Definition\ConfigurationInterface; |
||||
| 17 | |||||
| 18 | class Configuration implements ConfigurationInterface |
||||
| 19 | { |
||||
| 20 | /** |
||||
| 21 | * {@inheritdoc} |
||||
| 22 | */ |
||||
| 23 | 4 | public function getConfigTreeBuilder() |
|||
| 24 | { |
||||
| 25 | 4 | $treeBuilder = new TreeBuilder('eloyekunle_permissions'); |
|||
| 26 | 4 | $rootNode = method_exists(TreeBuilder::class, 'getRootNode') ? $treeBuilder->getRootNode() : $treeBuilder->root('eloyekunle_permissions'); |
|||
| 27 | |||||
| 28 | 4 | $supportedDrivers = ['orm']; |
|||
| 29 | |||||
| 30 | $rootNode |
||||
| 31 | 4 | ->addDefaultsIfNotSet() |
|||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||||
| 32 | 4 | ->children() |
|||
| 33 | 4 | ->scalarNode('db_driver') |
|||
| 34 | 4 | ->validate() |
|||
| 35 | 4 | ->ifNotInArray($supportedDrivers) |
|||
| 36 | 4 | ->thenInvalid('The driver %s is not supported. Please choose one of '.json_encode($supportedDrivers)) |
|||
| 37 | 4 | ->end() |
|||
| 38 | 4 | ->cannotBeOverwritten() |
|||
| 39 | 4 | ->defaultValue('orm') |
|||
| 40 | 4 | ->end() |
|||
| 41 | 4 | ->scalarNode('role_class')->isRequired()->cannotBeEmpty()->end() |
|||
| 42 | 4 | ->scalarNode('model_manager_name')->defaultNull()->end() |
|||
| 43 | 4 | ->end(); |
|||
| 44 | |||||
| 45 | 4 | $this->addModuleSection($rootNode); |
|||
| 46 | |||||
| 47 | 4 | return $treeBuilder; |
|||
| 48 | } |
||||
| 49 | |||||
| 50 | 4 | private function addModuleSection(ArrayNodeDefinition $node) |
|||
| 51 | { |
||||
| 52 | $node |
||||
| 53 | 4 | ->children() |
|||
| 54 | 4 | ->arrayNode('module') |
|||
| 55 | 4 | ->addDefaultsIfNotSet() |
|||
| 56 | 4 | ->canBeUnset() |
|||
| 57 | 4 | ->children() |
|||
| 58 | 4 | ->scalarNode('definitions_path')->cannotBeEmpty()->isRequired()->end() |
|||
| 59 | 4 | ->end(); |
|||
|
0 ignored issues
–
show
The method
end() does not exist on Symfony\Component\Config...der\NodeParentInterface. It seems like you code against a sub-type of said class. However, the method does not exist in Symfony\Component\Config...ion\Builder\TreeBuilder. Are you sure you never get one of those?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||
| 60 | 4 | } |
|||
| 61 | } |
||||
| 62 |