Input::getDefaultSpecs()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 6
ccs 3
cts 3
cp 1
rs 9.4285
cc 1
eloc 3
nc 1
nop 0
crap 1
1
<?php
2
namespace Sirius\Input\Element;
3
4
use Sirius\Input\Traits\HasFiltersTrait;
5
use Sirius\Input\Traits\HasLabelTrait;
6
use Sirius\Input\Element;
7
use Sirius\Input\Traits\HasValidationRulesTrait;
8
use Sirius\Input\Traits\HasHintTrait;
9
use Sirius\Input\Traits\HasAttributesTrait;
10
use Sirius\Input\Specs;
11
12
class Input extends Element
13
{
14
    use HasFiltersTrait;
15
    use HasValidationRulesTrait;
16
    use HasLabelTrait;
17
    use HasHintTrait;
18
    use HasAttributesTrait;
19
20
    /**
21
     * Name of the field (identifier of the element in the child list)
22
     *
23
     * @var string
24
     */
25
    protected $name;
26
27
    protected $value;
28
29
    /**
30
     *
31
     * @param string $name
32
     *            Name of the input element that will make it identifiable
33
     * @param array $specs
34
     *            Specification for the element (attributes, parents, etc)
35
     */
36 38
    public function __construct($name, $specs = array())
37
    {
38 38
        $specs = array_merge($this->getDefaultSpecs(), $specs);
39 38
        parent::__construct($name, $specs);
40 38
    }
41
42
    /**
43
     * Returns the default element specifications
44
     * To be used for easily extending objects
45
     *
46
     * @return array
47
     */
48 7
    protected function getDefaultSpecs()
49
    {
50
        return array(
51 7
            Specs::WIDGET => 'text'
52 7
        );
53
    }
54
}
55