Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
74 / 74 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
| ProfileFormType | |
100.00% |
74 / 74 |
|
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
| buildForm | |
100.00% |
74 / 74 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace App\Form; |
| 6 | |
| 7 | use App\Enum\MapBoxProfilesEnum; |
| 8 | use App\Enum\MapBoxStylesEnum; |
| 9 | use App\Enum\MapProvidersEnum; |
| 10 | use App\Enum\MaxfieldEngineEnum; |
| 11 | use App\Settings\UserSettings; |
| 12 | use Symfony\Component\Form\AbstractType; |
| 13 | use Symfony\Component\Form\Extension\Core\Type\EnumType; |
| 14 | use Symfony\Component\Form\Extension\Core\Type\NumberType; |
| 15 | use Symfony\Component\Form\FormBuilderInterface; |
| 16 | |
| 17 | /** |
| 18 | * @extends AbstractType<UserSettings> |
| 19 | */ |
| 20 | class ProfileFormType extends AbstractType |
| 21 | { |
| 22 | public function buildForm( |
| 23 | FormBuilderInterface $builder, |
| 24 | array $options |
| 25 | ): void |
| 26 | { |
| 27 | $builder |
| 28 | ->add('agentName', null, [ |
| 29 | 'required' => false, |
| 30 | 'empty_data' => '', |
| 31 | 'label' => 'Nombre del Agente', |
| 32 | ]) |
| 33 | ->add( |
| 34 | 'lat', |
| 35 | NumberType::class, |
| 36 | [ |
| 37 | 'required' => false, |
| 38 | 'scale' => 7, |
| 39 | 'attr' => [ |
| 40 | 'min' => -90, |
| 41 | 'max' => 90, |
| 42 | 'step' => 0.0000001, |
| 43 | ], |
| 44 | ] |
| 45 | ) |
| 46 | ->add( |
| 47 | 'lon', |
| 48 | NumberType::class, |
| 49 | [ |
| 50 | 'required' => false, |
| 51 | 'scale' => 7, |
| 52 | 'attr' => [ |
| 53 | 'min' => -90, |
| 54 | 'max' => 90, |
| 55 | 'step' => 0.0000001, |
| 56 | ], |
| 57 | ] |
| 58 | ) |
| 59 | ->add('zoom') |
| 60 | ->add('mapboxApiKey') |
| 61 | ->add( |
| 62 | 'defaultStyle', |
| 63 | EnumType::class, |
| 64 | [ |
| 65 | 'class' => MapBoxStylesEnum::class, |
| 66 | 'choice_label' => fn(MapBoxStylesEnum $category): string => str_replace('_', ' ', $category->name), |
| 67 | ] |
| 68 | ) |
| 69 | ->add( |
| 70 | 'defaultProfile', |
| 71 | EnumType::class, |
| 72 | [ |
| 73 | 'class' => MapBoxProfilesEnum::class, |
| 74 | ] |
| 75 | ) |
| 76 | ->add( |
| 77 | 'mapProvider', |
| 78 | EnumType::class, |
| 79 | [ |
| 80 | 'class' => MapProvidersEnum::class, |
| 81 | 'choice_label' => fn(MapProvidersEnum $element): string => ucfirst($element->name), |
| 82 | ] |
| 83 | ) |
| 84 | ->add( |
| 85 | 'maxfieldEngine', |
| 86 | EnumType::class, |
| 87 | [ |
| 88 | 'class' => MaxfieldEngineEnum::class, |
| 89 | 'choice_label' => fn(MaxfieldEngineEnum $element): string => ucfirst($element->name), |
| 90 | ] |
| 91 | ) |
| 92 | ->add( |
| 93 | 'dockerContainer', |
| 94 | null, |
| 95 | [ |
| 96 | 'required' => false, |
| 97 | 'empty_data' => '', |
| 98 | 'label' => 'Docker Container ID', |
| 99 | ] |
| 100 | ); |
| 101 | } |
| 102 | } |