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

QuickSearch::init()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 24
Code Lines 14

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 14
c 0
b 0
f 0
dl 0
loc 24
ccs 0
cts 18
cp 0
rs 9.7998
cc 1
nc 1
nop 0
crap 2
1
<?php
2
3
namespace mQueue\Form;
4
5
use Zend_Controller_Action_HelperBroker;
6
use Zend_Form;
7
8
class QuickSearch extends Zend_Form
9
{
10
    public function init(): void
11
    {
12
        $this->setMethod('get');
13
        $this->setName('quickSearch');
14
        $viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer');
15
        $view = $viewRenderer->view;
16
17
        $this->setAction($view->serverUrl() . $view->url(['controller' => 'movie', 'action' => 'index'], 'default', false));
18
19
        // Add the comment element
20
        $this->addElement('text', 'search', [
21
            'placeholder' => _tr('search movie…'),
22
            'decorators' => ['ViewHelper'],
23
        ]);
24
25
        // Add the submit button
26
        $this->addElement('submit', 'searchSubmit', [
27
            'label' => _tr('Search'),
28
            'decorators' => ['ViewHelper'],
29
        ]);
30
31
        $this->addDecorator('FormElements')
32
            ->addDecorator('HtmlTag', ['tag' => 'span'])
33
            ->addDecorator('Form');
34
    }
35
}
36