Total Complexity | 5 |
Total Lines | 31 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
18 | final class IdentifiedSiteType extends AbstractType |
||
19 | { |
||
20 | public function buildForm(FormBuilderInterface $builder, array $options): void |
||
26 | } |
||
27 | } |
||
28 | |||
29 | public function configureOptions(OptionsResolver $resolver): void |
||
30 | { |
||
31 | $resolver->setDefaults([ |
||
32 | 'exclude_sites' => [], |
||
33 | ]); |
||
34 | |||
35 | $resolver->setNormalizer('choices', function (Options $options, $value) { |
||
36 | if ($options['exclude_sites']) { |
||
37 | $value = array_filter($value, function (IdentifiedSiteInterface $site) use ($options): bool { |
||
38 | return !\in_array($site->getIdentifier(), $options['exclude_sites'], true); |
||
39 | }); |
||
40 | } |
||
41 | |||
42 | return $value; |
||
43 | }); |
||
44 | } |
||
45 | |||
46 | public function getParent(): string |
||
49 | } |
||
50 | } |
||
51 |