Completed
Push — master ( 591275...24655e )
by Derek Stephen
01:52
created

FieldAbstract::setClass()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 5
ccs 3
cts 3
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 1
crap 1
1
<?php
2
/**
3
 * User: delboy1978uk
4
 * Date: 19/11/2016
5
 * Time: 21:41
6
 */
7
8
namespace Del\Form\Field;
9
10
abstract class FieldAbstract implements FieldInterface
11
{
12
    /** @var string $name */
13
    private $name;
14
15
    /** @var string $id */
16
    private $id;
17
18
    /** @var string $class  */
19
    private $class;
20
21
    private $value;
22
23
    /**
24
     * @return string
25
     */
26
    abstract public function getTag();
27
28
    /**
29
     * @return mixed
30
     */
31
    abstract public function getTagType();
32
33 3
    public function __construct($name, $value)
34
    {
35 3
        $this->setName($name);
36 3
        $this->setValue($value);
37 3
    }
38
39
    /**
40
     * @return string
41
     */
42 3
    public function getName()
43
    {
44 3
        return $this->name;
45
    }
46
47
    /**
48
     * @param string $name
49
     * @return FieldAbstract
50
     */
51 3
    public function setName($name)
52
    {
53 3
        $this->name = $name;
54 3
        return $this;
55
    }
56
57
    /**
58
     * @return string
59
     */
60 2
    public function getId()
61
    {
62 2
        return $this->id;
63
    }
64
65
    /**
66
     * @param string $id
67
     * @return FieldAbstract
68
     */
69 2
    public function setId($id)
70
    {
71 2
        $this->id = $id;
72 2
        return $this;
73
    }
74
75
    /**
76
     * @return string
77
     */
78 2
    public function getClass()
79
    {
80 2
        return $this->class ?: 'form-control';
81
    }
82
83
    /**
84
     * @param string $class
85
     * @return FieldAbstract
86
     */
87 1
    public function setClass($class)
88
    {
89 1
        $this->class = $class;
90 1
        return $this;
91
    }
92
93
    /**
94
     * @return mixed
95
     */
96 2
    public function getValue()
97
    {
98 2
        return $this->value;
99
    }
100
101
    /**
102
     * @param mixed $value
103
     * @return FieldAbstract
104
     */
105 3
    public function setValue($value)
106
    {
107 3
        $this->value = $value;
108 3
        return $this;
109
    }
110
}