Issues (3627)

StageBundle/Form/Type/StageActionListType.php (1 issue)

1
<?php
2
3
/*
4
 * @copyright   2014 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\StageBundle\Form\Type;
13
14
use Mautic\StageBundle\Model\StageModel;
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
/**
21
 * Class StageActionType.
22
 */
23
class StageActionListType extends AbstractType
24
{
25
    private $model;
26
27
    public function __construct(StageModel $model)
28
    {
29
        $this->model = $model;
30
    }
31
32
    public function configureOptions(OptionsResolver $resolver)
33
    {
34
        $resolver->setDefaults([
35
            'choices' => function (Options $options) {
0 ignored issues
show
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

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

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...
36
                $stages = $this->model->getUserStages();
37
38
                $choices = [];
39
                foreach ($stages as $s) {
40
                    $choices[$s['name']] = $s['id'];
41
                }
42
43
                return $choices;
44
            },
45
            'required'          => false,
46
            ]);
47
    }
48
49
    /**
50
     * @return string|\Symfony\Component\Form\FormTypeInterface|null
51
     */
52
    public function getParent()
53
    {
54
        return ChoiceType::class;
55
    }
56
57
    /**
58
     * {@inheritdoc}
59
     */
60
    public function getBlockPrefix()
61
    {
62
        return 'stageaction_list';
63
    }
64
}
65