PreferenceChannelsType   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 14
dl 0
loc 34
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getParent() 0 3 1
A configureOptions() 0 15 1
A __construct() 0 3 1
1
<?php
2
3
/*
4
 * @copyright   2019 Mautic Contributors. All rights reserved
5
 * @author      Mautic
6
 *
7
 * @link        http://mautic.org
8
 *
9
 * @license     GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
10
 */
11
12
namespace Mautic\LeadBundle\Form\Type;
13
14
use Mautic\LeadBundle\Model\LeadModel;
15
use Symfony\Component\Form\AbstractType;
16
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
17
use Symfony\Component\OptionsResolver\Options;
18
use Symfony\Component\OptionsResolver\OptionsResolver;
19
20
class PreferenceChannelsType extends AbstractType
21
{
22
    /**
23
     * @var LeadModel
24
     */
25
    private $leadModel;
26
27
    public function __construct(LeadModel $leadModel)
28
    {
29
        $this->leadModel = $leadModel;
30
    }
31
32
    public function configureOptions(OptionsResolver $resolver)
33
    {
34
        $model = $this->leadModel;
35
36
        $resolver->setDefaults(
37
            [
38
                'choices'     => function (Options $options) use ($model) {
0 ignored issues
show
Unused Code introduced by
The parameter $options is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

38
                'choices'     => function (/** @scrutinizer ignore-unused */ Options $options) use ($model) {

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
39
                    return $model->getPreferenceChannels();
40
                },
41
                'placeholder' => '',
42
                'attr'        => ['class' => 'form-control'],
43
                'label_attr'  => ['class' => 'control-label'],
44
                'multiple'    => false,
45
                'expanded'    => false,
46
                'required'    => false,
47
            ]
48
        );
49
    }
50
51
    public function getParent()
52
    {
53
        return ChoiceType::class;
54
    }
55
}
56