Input   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 6

Test Coverage

Coverage 100%

Importance

Changes 3
Bugs 0 Features 0
Metric Value
wmc 2
c 3
b 0
f 0
lcom 0
cbo 6
dl 0
loc 43
ccs 7
cts 7
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getDefaultSpecs() 0 6 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