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

Movie::init()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 19
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 10
c 0
b 0
f 0
dl 0
loc 19
ccs 0
cts 14
cp 0
rs 9.9332
cc 1
nc 1
nop 0
crap 2
1
<?php
2
3
namespace mQueue\Form;
4
5
use Zend_Form;
6
7
class Movie extends Zend_Form
8
{
9
    public function init(): void
10
    {
11
        // Set the method for the display form to GET
12
        $this->setMethod('get');
13
14
        // Add the comment element
15
        $this->addElement('text', 'id', [
16
            'label' => _tr('IMDb url or id:'),
17
            'required' => true,
18
            'autofocus' => true,
19
            'validators' => [
20
                ['validator' => 'Regex', 'options' => ["/(\d{7,})/"]],
21
            ],
22
        ]);
23
24
        // Add the submit button
25
        $this->addElement('submit', 'submit', [
26
            'ignore' => true,
27
            'label' => _tr('Add movie'),
28
        ]);
29
    }
30
}
31