1 | <?php |
||
22 | |||
23 | class AuthorizationEndpointSource implements Component |
||
24 | { |
||
25 | /** |
||
26 | * @var Component[] |
||
27 | */ |
||
28 | private $subComponents = []; |
||
29 | |||
30 | /** |
||
31 | * AuthorizationEndpointSource constructor. |
||
32 | */ |
||
33 | public function __construct() |
||
38 | |||
39 | /** |
||
40 | * {@inheritdoc} |
||
41 | */ |
||
42 | public function name(): string |
||
46 | |||
47 | /** |
||
48 | * {@inheritdoc} |
||
49 | */ |
||
50 | public function load(array $configs, ContainerBuilder $container) |
||
61 | |||
62 | /** |
||
63 | * {@inheritdoc} |
||
64 | */ |
||
65 | public function getNodeDefinition(ArrayNodeDefinition $node, ArrayNodeDefinition $rootNode) |
||
66 | { |
||
67 | $childNode = $node->children() |
||
68 | ->arrayNode($this->name()) |
||
69 | ->canBeEnabled() |
||
70 | ->addDefaultsIfNotSet(); |
||
71 | |||
72 | $childNode->children() |
||
73 | ->scalarNode('path') |
||
74 | ->info('The path to the authorization endpoint.') |
||
75 | ->defaultValue('/authorize') |
||
76 | ->end() |
||
77 | ->scalarNode('login_route_name') |
||
78 | ->info('The name of the login route. Will be converted into URL and used to redirect the user if not logged in. If you use "FOSUserBundle", the route name should be "fos_user_security_login".') |
||
79 | ->end() |
||
80 | ->arrayNode('login_route_parameters') |
||
81 | ->info('Parameters associated to the login route (optional).') |
||
82 | ->useAttributeAsKey('name') |
||
83 | ->scalarPrototype()->end() |
||
84 | ->treatNullLike([]) |
||
85 | ->end() |
||
86 | ->scalarNode('template') |
||
87 | ->info('The consent page template.') |
||
88 | ->defaultValue('@OAuth2FrameworkBundle/authorization/authorization.html.twig') |
||
89 | ->end() |
||
90 | ->scalarNode('enforce_state') |
||
91 | ->info('If true the "state" parameter is mandatory (recommended).') |
||
92 | ->defaultFalse() |
||
93 | ->end() |
||
94 | ->end(); |
||
95 | |||
96 | foreach ($this->subComponents as $subComponent) { |
||
97 | $subComponent->getNodeDefinition($childNode, $node); |
||
98 | } |
||
99 | } |
||
127 |
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.