EmailField::renderInput()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
c 0
b 0
f 0
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 3
crap 1
1
<?php
2
3
namespace mindplay\kissform\Fields;
4
5
use mindplay\kissform\InputModel;
6
use mindplay\kissform\InputRenderer;
7
use mindplay\kissform\Validators\CheckEmail;
8
9
/**
10
 * This class represents an <input type="email"> element.
11
 */
12
class EmailField extends TextField
13
{
14
    /**
15
     * {@inheritdoc}
16
     */
17 1
    public function renderInput(InputRenderer $renderer, InputModel $model, array $attr)
18
    {
19 1
        return $renderer->inputFor($this, 'email', $attr + ['maxlength' => $this->max_length]);
20
    }
21
22
    /**
23
     * {@inheritdoc}
24
     */
25 1
    public function createValidators()
26
    {
27 1
        $validators = parent::createValidators();
28
29 1
        $validators[] = new CheckEmail();
30
31 1
        return $validators;
32
    }
33
}
34