Setting::getKey()   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
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
3
namespace WebCMS\Entity;
4
5
use Doctrine\ORM\Mapping as orm;
6
7
/**
8
 * Description of Settings
9
 * @ORM\Entity
10
 * @author Tomáš Voslař <tomas.voslar at webcook.cz>
11
 */
12
class Setting extends Entity
13
{
14
    /**
15
     * @ORM\Column(name="`key`")
16
     * @var String
17
     */
18
    private $key;
19
20
    /**
21
     * @ORM\Column(type="text")
22
     * @var String
23
     */
24
    private $value;
25
26
    /**
27
     * @ORM\Column
28
     * @var String
29
     */
30
    private $section;
31
32
    /**
33
     * @ORM\Column(nullable=true)
34
     * @var String
35
     */
36
    private $type;
37
38
    /**
39
     * @ORM\Column(nullable=true)
40
     * @var String
41
     */
42
    private $options;
43
44
    /**
45
     * @orm\ManyToOne(targetEntity="Language")
46
     * @orm\JoinColumn(name="language_id", referencedColumnName="id", onDelete="CASCADE", nullable=true)
47
     */
48
    private $language;
49
50 41
    public function getValue($raw = true, $fromPush = array(), $toPush = array())
51
    {
52 41
        if ($raw) {
53 41
            return $this->value;
54
        } else {
55
            return \WebCMS\Helpers\SystemHelper::replaceStatic($this->value, $fromPush, $toPush);
56
        }
57
    }
58
59
    /**
60
     * @param string $value
61
     */
62 41
    public function setValue($value)
63
    {
64 41
        $this->value = $value;
65 41
    }
66
67 7
    public function getLanguage()
68
    {
69 7
        return $this->language;
70
    }
71
72
    /**
73
     * @param Language $language
74
     */
75 41
    public function setLanguage($language)
76
    {
77 41
        $this->language = $language;
78 41
    }
79
80 35
    public function getType()
81
    {
82 35
        return $this->type;
83
    }
84
85
    /**
86
     * @param string $type
87
     */
88 41
    public function setType($type)
89
    {
90 41
        $this->type = $type;
91 41
    }
92
93 7
    public function getKey()
94
    {
95 7
        return $this->key;
96
    }
97
98
    /**
99
     * @param string $key
100
     */
101 41
    public function setKey($key)
102
    {
103 41
        $this->key = $key;
104 41
    }
105
106 7
    public function getSection()
107
    {
108 7
        return $this->section;
109
    }
110
111
    /**
112
     * @param string $section
113
     */
114 41
    public function setSection($section)
115
    {
116 41
        $this->section = $section;
117 41
    }
118
119 2
    public function getOptions()
120
    {
121 2
        return unserialize($this->options);
122
    }
123
124 41
    public function setOptions($options)
125
    {
126 41
        $this->options = serialize($options);
127 41
    }
128
}
129