Passed
Push — master ( afdc6b...e39cc4 )
by Adrien
03:24
created

Import   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 52
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 1
eloc 30
c 0
b 0
f 0
dl 0
loc 52
ccs 0
cts 39
cp 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A init() 0 50 1
1
<?php
2
3
namespace mQueue\Form;
4
5
use Zend_Form;
6
7
class Import extends Zend_Form
8
{
9
    public function init(): void
10
    {
11
        // Set the method for the display form to POST
12
        $this->setMethod('post');
13
14
        // Add the comment element
15
        $this->addElement('text', 'url', [
16
            'label' => _tr('IMDb "Vote History" page url:'),
17
            'autofocus' => true,
18
            'required' => true,
19
            'description' => _tr('eg: http://www.imdb.com/mymovies/list?l=39480251'),
20
            'validators' => [
21
                ['validator' => 'Regex', 'options' => ["|mymovies/list\?l=\d+|"]],
22
            ],
23
        ]);
24
25
        // Add the minimum for favorite
26
        $this->addElement('text', 'favoriteMinimum', [
27
            'label' => _tr('Minimum for favorite:'),
28
            'required' => true,
29
            'validators' => [
30
                ['validator' => 'Between', 'options' => [0, 10]],
31
                ['validator' => 'Float', 'options' => []],
32
            ],
33
        ]);
34
35
        // Add the minimum for excellent
36
        $this->addElement('text', 'excellentMinimum', [
37
            'label' => _tr('Minimum for excellent:'),
38
            'required' => true,
39
            'validators' => [
40
                ['validator' => 'Between', 'options' => [0, 10]],
41
                ['validator' => 'Float', 'options' => []],
42
            ],
43
        ]);
44
45
        // Add the minimum for favorite
46
        $this->addElement('text', 'okMinimum', [
47
            'label' => _tr('Minimum for ok:'),
48
            'required' => true,
49
            'validators' => [
50
                ['validator' => 'Between', 'options' => [0, 10]],
51
                ['validator' => 'Float', 'options' => []],
52
            ],
53
        ]);
54
55
        // Add the submit button
56
        $this->addElement('submit', 'submit', [
57
            'ignore' => true,
58
            'label' => 'Add movie',
59
        ]);
60
    }
61
}
62