CronType   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 3
c 0
b 0
f 0
lcom 0
cbo 3
dl 0
loc 39
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A buildForm() 0 19 1
A configureOptions() 0 6 1
A getName() 0 4 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