GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

AutocompleteType   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 18
c 1
b 0
f 0
dl 0
loc 39
rs 10
wmc 6

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getBlockPrefix() 0 3 1
A buildView() 0 16 3
A configureOptions() 0 8 1
A getParent() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * (c) Christian Gripp <[email protected]>
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 Core23\Form\Type;
13
14
use PUGX\AutocompleterBundle\Form\Type\AutocompleteType as BaseAutocompleteType;
15
use Symfony\Component\Form\AbstractType;
16
use Symfony\Component\Form\FormInterface;
17
use Symfony\Component\Form\FormView;
18
use Symfony\Component\OptionsResolver\OptionsResolver;
19
use Symfony\Component\PropertyAccess\PropertyAccess;
20
21
final class AutocompleteType extends AbstractType
22
{
23
    public function configureOptions(OptionsResolver $resolver): void
24
    {
25
        $resolver
26
            ->setDefaults([
27
                'property'    => null,
28
                'empty_value' => '',
29
            ])
30
            ->setRequired('route_name')
31
        ;
32
    }
33
34
    public function buildView(FormView $view, FormInterface $form, array $options): void
35
    {
36
        $text = null;
37
38
        if (null !== $data = $form->getData()) {
39
            if (null !== $options['property']) {
40
                $accessor = PropertyAccess::createPropertyAccessor();
41
                $accessor->getValue($data, $options['property']);
42
            } else {
43
                $text = (string) $data;
44
            }
45
        }
46
47
        $view->vars['text']        = $text;
48
        $view->vars['route_name']  = $options['route_name'];
49
        $view->vars['empty_value'] = $options['empty_value'];
50
    }
51
52
    public function getBlockPrefix()
53
    {
54
        return 'core23_autocomplete';
55
    }
56
57
    public function getParent()
58
    {
59
        return BaseAutocompleteType::class;
60
    }
61
}
62