Completed
Push — master ( d73c00...d68ab4 )
by Anılcan
01:20
created

Field::setType()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
namespace AnilcanCakir\Former\Fields;
4
5
use Illuminate\Contracts\Translation\Translator;
6
7
abstract class Field
8
{
9
    /**
10
     * The name of field.
11
     *
12
     * @var string
13
     */
14
    protected $name;
15
16
    /**
17
     * The label of field.
18
     *
19
     * @var
20
     */
21
    protected $label;
22
23
    /**
24
     * The type of field.
25
     *
26
     * @var string
27
     */
28
    protected $type = 'text';
29
30
    /**
31
     * The template of field.
32
     *
33
     * @var string
34
     */
35
    protected $template;
36
    /**
37
     * translator of Field
38
     *
39
     * @var Translator
40
     */
41
    private $translator;
42
43
    /**
44
     * Field constructor.
45
     *
46
     * @param Translator $translator
47
     */
48
    public function __construct(Translator $translator)
49
    {
50
        $this->translator = $translator;
51
    }
52
53
    /**
54
     * Get the name of field.
55
     *
56
     * @return string
57
     */
58
    public function getName(): string
59
    {
60
        return $this->name;
61
    }
62
63
    /**
64
     * Get the label of field.
65
     *
66
     * @return string
67
     */
68
    public function getLabel(): string
69
    {
70
        if ($this->label) {
71
            return $this->label;
72
        }
73
    }
74
75
    /**
76
     * Get the type of field.
77
     *
78
     * @return string
79
     */
80
    public function getType(): string
81
    {
82
        return $this->type;
83
    }
84
85
    /**
86
     * Get the template of field.
87
     *
88
     * @return string
89
     */
90
    public function getTemplate(): string
91
    {
92
        return $this->template;
93
    }
94
95
    /**
96
     * Set the name of field.
97
     *
98
     * @param string $name
99
     */
100
    public function setName(string $name)
101
    {
102
        $this->name = $name;
103
    }
104
105
    /**
106
     * Set the type of field.
107
     *
108
     * @param string $type
109
     */
110
    public function setType(string $type)
111
    {
112
        $this->type = $type;
113
    }
114
}