CronType::configureOptions()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 1
1
<?php
2
3
namespace FOA\CronBundle\Form\Type;
4
5
use Symfony\Component\Form\FormBuilderInterface;
6
use Symfony\Component\Form\AbstractType;
7
use Symfony\Component\OptionsResolver\OptionsResolver;
8
9
/**
10
 * Cron job form type
11
 *
12
 * @author Novikov Viktor
13
 */
14
class CronType extends AbstractType
15
{
16
    public function buildForm(FormBuilderInterface $builder, array $options)
17
    {
18
        $builder
19
            ->add('minute')
20
            ->add('hour')
21
            ->add('dayOfMonth')
22
            ->add('month')
23
            ->add('dayOfWeek')
24
            ->add('command')
25
            ->add('logFile', 'text', [
26
                'required' => false,
27
            ])
28
            ->add('errorFile', 'text', [
29
                'required' => false,
30
            ])
31
            ->add('comment', 'text', [
32
                'required' => false,
33
            ]);
34
    }
35
36
    public function configureOptions(OptionsResolver $resolver)
37
    {
38
        $resolver->setDefaults([
39
            'data_class' => 'FOA\CronBundle\Manager\Cron'
40
        ]);
41
    }
42
43
    /**
44
     * Returns the name of this type.
45
     *
46
     * @return string The name of this type
47
     */
48
    public function getName()
49
    {
50
        return 'cron';
51
    }
52
}
53