Completed
Push — develop ( 7b602d...d209d7 )
by
unknown
08:13
created

TemplateValues::getLanguage()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
/**
3
 * YAWIK
4
 *
5
 * @filesource
6
 * @copyright (c) 2013-2015 Cross Solution (http://cross-solution.de)
7
 * @license   MIT
8
 * @author    [email protected]
9
 */
10
11
namespace Jobs\Entity;
12
13
use Core\Entity\AbstractEntity;
14
use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM;
15
16
/**
17
 * Holds various fields a o job opening template
18
 *
19
 * @ODM\EmbeddedDocument
20
 * @ODM\Indexes({
21
 *   @ODM\Index(keys={"requirements"="text",
22
 *                    "description"="text",
23
 *                    "qualifications"="text",
24
 *                    "benefits"="text",
25
 *                    "title"="text"},
26
 *              name="fulltext")
27
 * })
28
 */
29
class TemplateValues extends AbstractEntity implements TemplateValuesInterface
0 ignored issues
show
Coding Style introduced by
The property $_freeValues is not named in camelCase.

This check marks property names that have not been written in camelCase.

In camelCase names are written without any punctuation, the start of each new word being marked by a capital letter. Thus the name database connection string becomes databaseConnectionString.

Loading history...
30
{
31
32
    /**
33
     * Qualification field of the job template
34
     *
35
     * @var String
36
     * @ODM\String
37
     */
38
    protected $qualifications='';
39
40
    /**
41
     * Requirements field of the job template
42
     *
43
     * @var String
44
     * @ODM\String
45
     */
46
    protected $requirements='';
47
48
    /**
49
     * Benefits field of the job template
50
     *
51
     * @var String
52
     * @ODM\String
53
     */
54
    protected $benefits='';
55
56
    /**
57
     * Job title field of the job template
58
     *
59
     * @var String
60
     * @ODM\String
61
     */
62
    protected $title='';
63
64
    /**
65
     * Company description field of the job template
66
     *
67
     * @var String
68
     * @ODM\String
69
     */
70
    protected $description='';
71
72
    /**
73
     * language of the job template values
74
     *
75
     * @var String
76
     * @ODM\String
77
     */
78
    protected $language='';
79
80
    /**
81
     * free values (currently not in use)
82
     *
83
     * @ODM\Hash
84
     */
85
    protected $_freeValues;
0 ignored issues
show
Coding Style introduced by
$_freeValues does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
86
87
    /**
88
     * Sets the Qualification field of the job template
89
     *
90
     * @param $qualifications
91
     * @return $this
92
     */
93
    public function setQualifications($qualifications)
94
    {
95
        $this->qualifications= (string) $qualifications;
96
        return $this;
97
    }
98
99
    /**
100
     * Gets the qualification of a job template
101
     *
102
     * @return String
103
     */
104
    public function getQualifications()
105
    {
106
        return $this->qualifications;
107
    }
108
109
    /**
110
     * Sets the requirements of a job template
111
     *
112
     * @param String $requirements
113
     * @return $this
114
     */
115
    public function setRequirements($requirements)
116
    {
117
        $this->requirements=(string) $requirements;
118
        return $this;
119
    }
120
121
    /**
122
     * Gets the requirements of a job template
123
     *
124
     * @return String
125
     */
126
    public function getRequirements()
127
    {
128
        return $this->requirements;
129
    }
130
131
    /**
132
     * Sets the benefits of a job template
133
     *
134
     * @param String $benefits
135
     * @return $this
136
     */
137
    public function setBenefits($benefits)
138
    {
139
        $this->benefits=(string) $benefits;
140
        return $this;
141
    }
142
143
    /**
144
     * Gets the Benefits of a job template
145
     *
146
     * @return String
147
     */
148
    public function getBenefits()
149
    {
150
        return $this->benefits;
151
    }
152
153
    /**
154
     * Sets the job title of the job template
155
     *
156
     * @param $title
157
     * @return $this
158
     */
159
    public function setTitle($title)
160
    {
161
        $this->title=(string) $title;
162
        return $this;
163
    }
164
165
    /**
166
     * Gets the job title of the job template
167
     *
168
     * @return String
169
     */
170
    public function getTitle()
171
    {
172
        return $this->title;
173
    }
174
175
    /**
176
     * Sets the company description of the job template
177
     *
178
     * @param $description
179
     * @return $this
180
     */
181
    public function setDescription($description)
182
    {
183
        $this->description=(string) $description;
184
        return $this;
185
    }
186
187
    /**
188
     * Gets the company description of the job template
189
     *
190
     * @return String
191
     */
192
    public function getDescription()
193
    {
194
        return $this->description;
195
    }
196
197
    /**
198
     * Sets the language of the job template values
199
     *
200
     * @param $language
201
     * @return $this
202
     */
203
    public function setLanguage($language)
204
    {
205
        $this->language=(string) $language;
206
        return $this;
207
    }
208
209
    /**
210
     * Gets the language of the job template values
211
     *
212
     * @return String
213
     */
214
    public function getLanguage()
215
    {
216
        return $this->language;
217
    }
218
219
    /**
220
     * @param null $key
221
     * @param null $default
222
     * @param bool $set
223
     * @return null
224
     */
225 View Code Duplication
    public function get($key = null, $default = null, $set = false)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
226
    {
227
        if (isset($this->_freeValues[$key])) {
228
            return $this->_freeValues[$key];
229
        }
230
        if ($set) {
231
            $this->set($key, $default);
232
        }
233
        return $default;
234
    }
235
236
    /**
237
     * @param $key
238
     * @param $value
239
     * @return $this
240
     */
241
    public function set($key, $value)
242
    {
243
        //$this->checkWriteAccess();
0 ignored issues
show
Unused Code Comprehensibility introduced by
84% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
244
        $this->_freeValues[$key] = $value;
245
        return $this;
246
    }
247
248 View Code Duplication
    public function __get($property)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
249
    {
250
        $getter = "get" . ucfirst($property);
251
        if (method_exists($this, $getter)) {
252
            return $this->$getter();
253
        }
254
255
        if (property_exists($this, $property)) {
256
            return $this->$property;
257
        }
258
259
        return $this->get($property);
260
    }
261
262 View Code Duplication
    public function __set($property, $value)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
263
    {
264
        //$this->checkWriteAccess();
0 ignored issues
show
Unused Code Comprehensibility introduced by
84% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
265
        $setter = 'set' . ucfirst($property);
266
        if (method_exists($this, $setter)) {
267
            $this->$setter($value);
268
            return;
269
        }
270
271
        if (property_exists($this, $property)) {
272
            $this->$property = $value;
273
            return;
274
        }
275
276
        $this->set($property, $value);
277
    }
278
279 View Code Duplication
    public function __isset($property)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
280
    {
281
        $value = $this->__get($property);
282
283
        if (is_array($value) && !count($value)) {
284
            return false;
285
        }
286
        if (is_bool($value) || is_object($value)) {
287
            return true;
288
        }
289
        return (bool) $value;
290
    }
291
}
292