1 | <?php |
||
22 | class SessionManagementEndpointSource implements Component |
||
23 | { |
||
24 | /** |
||
25 | * @return string |
||
26 | */ |
||
27 | public function name(): string |
||
31 | |||
32 | /** |
||
33 | * {@inheritdoc} |
||
34 | */ |
||
35 | public function load(array $configs, ContainerBuilder $container) |
||
45 | |||
46 | /** |
||
47 | * {@inheritdoc} |
||
48 | */ |
||
49 | public function getNodeDefinition(NodeDefinition $node) |
||
50 | { |
||
51 | $node->children() |
||
52 | ->arrayNode($this->name()) |
||
53 | ->addDefaultsIfNotSet() |
||
54 | ->canBeEnabled() |
||
55 | ->validate() |
||
56 | ->ifTrue(function ($config) { |
||
57 | return true === $config['enabled'] && empty($config['path']); |
||
58 | }) |
||
59 | ->thenInvalid('The route name must be set.') |
||
60 | ->end() |
||
61 | ->validate() |
||
62 | ->ifTrue(function ($config) { |
||
63 | return true === $config['enabled'] && empty($config['storage_name']); |
||
64 | })->thenInvalid('The option "storage_name" must be set.') |
||
65 | ->end() |
||
66 | ->validate() |
||
67 | ->ifTrue(function ($config) { |
||
68 | return true === $config['enabled'] && empty($config['template']); |
||
69 | })->thenInvalid('The option "template" must be set.') |
||
70 | ->end() |
||
71 | ->children() |
||
72 | ->scalarNode('path') |
||
73 | ->end() |
||
74 | ->scalarNode('storage_name') |
||
75 | ->defaultValue('oidc_browser_state') |
||
76 | ->end() |
||
77 | ->scalarNode('template') |
||
78 | ->info('The template of the OP iframe.') |
||
79 | ->defaultValue('@OAuth2FrameworkBundle/iframe/iframe.html.twig') |
||
94 |
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
Both the
$myVar
assignment in line 1 and the$higher
assignment in line 2 are dead. The first because$myVar
is never used and the second because$higher
is always overwritten for every possible time line.