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.

EmployeeType::buildForm()   A
last analyzed

Complexity

Conditions 4
Paths 1

Size

Total Lines 26

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 26
rs 9.504
c 0
b 0
f 0
cc 4
nc 1
nop 2
1
<?php
2
declare(strict_types=1);
3
4
/*
5
 * This file is part of the AL labs package
6
 *
7
 * (c) Arnaud Langlade
8
 *
9
 * For the full copyright and license information, please view the LICENSE
10
 * file that was distributed with this source code.
11
 */
12
13
namespace Al\ResourceManagement\Infrastructure\UserInterface\Web;
14
15
use Al\ResourceManagement\Application\Command\FireEmployee;
16
use Al\ResourceManagement\Application\Command\HireEmployee;
17
use Al\ResourceManagement\Application\Command\PromoteEmployee;
18
use Symfony\Component\Form\AbstractType;
19
use Symfony\Component\Form\Extension\Core\Type\DateType;
20
use Symfony\Component\Form\FormBuilderInterface;
21
use Symfony\Component\Form\FormEvent;
22
use Symfony\Component\Form\FormEvents;
23
24
final class EmployeeType extends AbstractType
25
{
26
    /**
27
     * {@inheritdoc}
28
     */
29
    public function buildForm(FormBuilderInterface $builder, array $options)
30
    {
31
        $builder->addEventListener(FormEvents::PRE_SET_DATA, function (FormEvent $event) {
32
            $employee = $event->getData();
33
34
            if ($employee instanceof HireEmployee) {
35
                $form = $event->getForm();
36
                $form->add('name');
37
                $form->add('position');
38
                $form->add('salaryScale');
39
            }
40
41
            if ($employee instanceof PromoteEmployee) {
42
                $form = $event->getForm();
43
                $form->add('position');
44
                $form->add('salaryScale');
45
            }
46
47
            if ($employee instanceof FireEmployee) {
48
                $form = $event->getForm();
49
                $form->add('firedAt', DateType::class, [
50
                    'widget' => 'single_text',
51
                ]);
52
            }
53
        });
54
    }
55
}
56