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

QuickSearch   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 1
eloc 15
c 0
b 0
f 0
dl 0
loc 26
ccs 0
cts 18
cp 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A init() 0 24 1
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