Completed
Push — master ( 6105f5...b898d5 )
by Bastian
13:51
created

Field   A

Complexity

Total Complexity 26

Size/Duplication

Total Lines 291
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 95.38%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 26
c 1
b 0
f 0
lcom 0
cbo 0
dl 0
loc 291
ccs 62
cts 65
cp 0.9538
rs 10

26 Methods

Rating   Name   Duplication   Size   Complexity  
A getName() 0 4 1
A setName() 0 5 1
A getType() 0 4 1
A setType() 0 5 1
A getLength() 0 4 1
A setLength() 0 5 1
A getTitle() 0 4 1
A setTitle() 0 5 1
A getDescription() 0 4 1
A setDescription() 0 5 1
A getExposeAs() 0 4 1
A setExposeAs() 0 5 1
A getReadOnly() 0 4 1
A setReadOnly() 0 5 1
A getRequired() 0 4 1
A setRequired() 0 5 1
A getTranslatable() 0 4 1
A setTranslatable() 0 5 1
A getConstraints() 0 4 1
A setConstraints() 0 5 1
A getCollection() 0 4 1
A setCollection() 0 5 1
A getXDynamicKey() 0 4 1
A setXDynamicKey() 0 5 1
A getSearchable() 0 4 1
A setSearchable() 0 4 1
1
<?php
2
/**
3
 * Part of JSON definition
4
 */
5
namespace Graviton\GeneratorBundle\Definition\Schema;
6
7
use Graviton\GeneratorBundle\Definition\Schema\XDynamicKey;
8
9
/**
10
 * JSON definition "target.fields"
11
 *
12
 * @author   List of contributors <https://github.com/libgraviton/graviton/graphs/contributors>
13
 * @license  http://opensource.org/licenses/gpl-license.php GNU Public License
14
 * @link     http://swisscom.ch
15
 */
16
class Field
17
{
18
    /**
19
     * @var string
20
     */
21
    private $name;
22
    /**
23
     * @var string
24
     */
25
    private $type;
26
    /**
27
     * @var int
28
     */
29
    private $length;
30
    /**
31
     * @var string
32
     */
33
    private $title;
34
    /**
35
     * @var string
36
     */
37
    private $description;
38
    /**
39
     * @var string
40
     */
41
    private $exposeAs;
42
    /**
43
     * @var bool
44
     */
45
    private $readOnly = false;
46
    /**
47
     * @var bool
48
     */
49
    private $required = false;
50
    /**
51
     * @var bool
52
     */
53
    private $searchable = false;
54
    /**
55
     * @var bool
56
     */
57
    private $translatable = false;
58
    /**
59
     * @var Constraint[]
60
     */
61
    private $constraints = [];
62
63
    /**
64
     * @var array
65
     */
66
    private $collection = [];
67
68
    /**
69
     * @var XDynamicKey
70
     */
71
    private $xDynamicKey;
72
73
    /**
74
     * @return string
75
     */
76 30
    public function getName()
77
    {
78 30
        return $this->name;
79
    }
80
81
    /**
82
     * @param string $name Field name
83
     * @return $this
84
     */
85 16
    public function setName($name)
86
    {
87 16
        $this->name = $name;
88 16
        return $this;
89
    }
90
91
    /**
92
     * @return string
93
     */
94 80
    public function getType()
95
    {
96 80
        return $this->type;
97
    }
98
99
    /**
100
     * @param string $type Field type
101
     * @return $this
102
     */
103 58
    public function setType($type)
104
    {
105 58
        $this->type = $type;
106 58
        return $this;
107
    }
108
109
    /**
110
     * @return int
111
     */
112 16
    public function getLength()
113
    {
114 16
        return $this->length;
115
    }
116
117
    /**
118
     * @param int $length Field length
119
     * @return $this
120
     */
121 4
    public function setLength($length)
122
    {
123 4
        $this->length = $length;
124 4
        return $this;
125
    }
126
127
    /**
128
     * @return string
129
     */
130 22
    public function getTitle()
131
    {
132 22
        return $this->title;
133
    }
134
135
    /**
136
     * @param string $title Field title
137
     * @return $this
138
     */
139 6
    public function setTitle($title)
140
    {
141 6
        $this->title = $title;
142 6
        return $this;
143
    }
144
145
    /**
146
     * @return string
147
     */
148 22
    public function getDescription()
149
    {
150 22
        return $this->description;
151
    }
152
153
    /**
154
     * @param string $description Field description
155
     * @return $this
156
     */
157 12
    public function setDescription($description)
158
    {
159 12
        $this->description = $description;
160 12
        return $this;
161
    }
162
163
    /**
164
     * @return string
165
     */
166 18
    public function getExposeAs()
167
    {
168 18
        return $this->exposeAs;
169
    }
170
171
    /**
172
     * @param string $exposeAs Expose field as ...
173
     * @return $this
174
     */
175 10
    public function setExposeAs($exposeAs)
176
    {
177 10
        $this->exposeAs = $exposeAs;
178 10
        return $this;
179
    }
180
181
    /**
182
     * @return bool
183
     */
184 18
    public function getReadOnly()
0 ignored issues
show
Coding Style introduced by
function getReadOnly() does not seem to conform to the naming convention (^(?:is|has|should|may|supports)).

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...
185
    {
186 18
        return $this->readOnly;
187
    }
188
189
    /**
190
     * @param bool $readOnly Is field readonly
191
     * @return $this
192
     */
193 6
    public function setReadOnly($readOnly)
194
    {
195 6
        $this->readOnly = $readOnly;
196 6
        return $this;
197
    }
198
199
    /**
200
     * @return bool
201
     */
202 18
    public function getRequired()
0 ignored issues
show
Coding Style introduced by
function getRequired() does not seem to conform to the naming convention (^(?:is|has|should|may|supports)).

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...
203
    {
204 18
        return $this->required;
205
    }
206
207
    /**
208
     * @param bool $required Is field required
209
     * @return $this
210
     */
211 10
    public function setRequired($required)
212
    {
213 10
        $this->required = $required;
214 10
        return $this;
215
    }
216
217
    /**
218
     * @return bool
219
     */
220 16
    public function getTranslatable()
0 ignored issues
show
Coding Style introduced by
function getTranslatable() does not seem to conform to the naming convention (^(?:is|has|should|may|supports)).

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...
221
    {
222 16
        return $this->translatable;
223
    }
224
225
    /**
226
     * @param bool $translatable Is field translatable
227
     * @return $this
228
     */
229 4
    public function setTranslatable($translatable)
230
    {
231 4
        $this->translatable = $translatable;
232 4
        return $this;
233
    }
234
235
    /**
236
     * @return Constraint[]
237
     */
238 16
    public function getConstraints()
239
    {
240 16
        return $this->constraints;
241
    }
242
243
    /**
244
     * @param Constraint[] $constraints Field constraints
245
     * @return $this
246
     */
247 4
    public function setConstraints(array $constraints)
248
    {
249 4
        $this->constraints = $constraints;
250 4
        return $this;
251
    }
252
253
    /**
254
     * @return array
255
     */
256 16
    public function getCollection()
257
    {
258 16
        return $this->collection;
259
    }
260
261
    /**
262
     * @param array $collection Field
263
     * @return $this
264
     */
265 4
    public function setCollection(array $collection)
266
    {
267 4
        $this->collection = $collection;
268 4
        return $this;
269
    }
270
271
    /**
272
     * @return XDynamicKey
273
     */
274 16
    public function getXDynamicKey()
275
    {
276 16
        return $this->xDynamicKey;
277
    }
278
279
    /**
280
     * @param XDynamicKey $xDynamicKey x-dynamic-key field value
281
     * @return $this
282
     */
283 2
    public function setXDynamicKey(XDynamicKey $xDynamicKey)
284
    {
285 2
        $this->xDynamicKey = $xDynamicKey;
286 2
        return $this;
287
    }
288
289
    /**
290
     * @return mixed
0 ignored issues
show
Documentation introduced by
Consider making the return type a bit more specific; maybe use boolean.

This check looks for the generic type array as a return type and suggests a more specific type. This type is inferred from the actual code.

Loading history...
291
     */
292 18
    public function getSearchable()
0 ignored issues
show
Coding Style introduced by
function getSearchable() does not seem to conform to the naming convention (^(?:is|has|should|may|supports)).

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...
293
    {
294 18
        return $this->searchable;
295
    }
296
297
    /**
298
     * @param mixed $searchable searchable flag
299
     *
300
     * @return void
301
     */
302
    public function setSearchable($searchable)
303
    {
304
        $this->searchable = $searchable;
305
    }
306
}
307