These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | declare(strict_types=1); |
||
4 | |||
5 | /* |
||
6 | * The MIT License (MIT) |
||
7 | * |
||
8 | * Copyright (c) 2014-2018 Spomky-Labs |
||
9 | * |
||
10 | * This software may be modified and distributed under the terms |
||
11 | * of the MIT license. See the LICENSE file for details. |
||
12 | */ |
||
13 | |||
14 | namespace OAuth2Framework\ServerBundle\Form\Type; |
||
15 | |||
16 | use OAuth2Framework\ServerBundle\Form\Model\AuthorizationModel; |
||
17 | use Symfony\Component\Form\AbstractType; |
||
18 | use Symfony\Component\Form\Extension\Core\Type\SubmitType; |
||
19 | use Symfony\Component\Form\FormBuilderInterface; |
||
20 | use Symfony\Component\OptionsResolver\OptionsResolver; |
||
21 | |||
22 | class AuthorizationType extends AbstractType |
||
23 | { |
||
24 | public function buildForm(FormBuilderInterface $builder, array $options) |
||
25 | { |
||
26 | /*if (true === $options['allow_scope_selection']) { |
||
0 ignored issues
–
show
|
|||
27 | $builder->add('scopes', ChoiceType::class, [ |
||
28 | 'label' => $translator->trans('authorization.form.scope', [], $options['translation_domain'], $options['locale']), |
||
29 | 'multiple' => 'true', |
||
30 | 'expanded' => 'true', |
||
31 | 'required' => false, |
||
32 | 'choices' => $options['scopes'], |
||
33 | 'choices_as_values' => true, |
||
34 | 'choice_label' => function ($allChoices, $key) use ($options) { |
||
35 | return $translator->trans('authorization.form.scope.'.$allChoices, [], $options['translation_domain'], $options['locale']); |
||
36 | }, |
||
37 | 'choice_name' => function ($allChoices, $key) { |
||
38 | return $allChoices; |
||
39 | }, |
||
40 | ]); |
||
41 | }*/ |
||
42 | $builder |
||
43 | ->add('accept', SubmitType::class, [ |
||
44 | 'label' => 'authorization.form.accept', |
||
45 | ]) |
||
46 | ->add('reject', SubmitType::class, [ |
||
47 | 'label' => 'authorization.form.reject', |
||
48 | ]); |
||
49 | } |
||
50 | |||
51 | public function configureOptions(OptionsResolver $resolver) |
||
52 | { |
||
53 | $resolver->setDefaults([ |
||
54 | 'translation_domain' => 'OAuth2FrameworkServer', |
||
55 | 'data_class' => AuthorizationModel::class, |
||
56 | 'scopes' => [], |
||
57 | 'locale' => null, |
||
58 | ]); |
||
59 | $resolver->setAllowedTypes('locale', ['string', 'null']); |
||
60 | $resolver->setAllowedTypes('scopes', 'array'); |
||
61 | } |
||
62 | |||
63 | public function getBlockPrefix() |
||
64 | { |
||
65 | return 'oauth2_server_authorization'; |
||
66 | } |
||
67 | } |
||
68 |
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.
The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.
This check looks for comments that seem to be mostly valid code and reports them.