Movie::init()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 19
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 1

Importance

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