CardSimpleProperties::setPage()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 2.0625

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
c 1
b 0
f 0
dl 0
loc 8
ccs 3
cts 4
cp 0.75
rs 10
cc 2
nc 2
nop 1
crap 2.0625
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Application\Traits;
6
7
use Application\Utility;
8
use Doctrine\ORM\Mapping as ORM;
9
use Ecodev\Felix\Model\Traits\HasUrl;
10
11
/**
12
 * Trait for "simple" properties of an card.
13
 *
14
 * They are mostly what was called "meta" in the old DILPS. And we split
15
 * them only to reduce the Card class size to focus on most important code.
16
 */
17
trait CardSimpleProperties
18
{
19
    use HasUrl;
20
21
    #[ORM\Column(type: 'text', options: ['default' => ''])]
22
    private string $addition = '';
23
24
    #[ORM\Column(type: 'text', options: ['default' => ''])]
25
    private string $expandedName = '';
26
27
    #[ORM\Column(type: 'string', options: ['default' => ''])]
28
    private string $material = '';
29
30
    #[ORM\Column(type: 'string', options: ['default' => ''])]
31
    private string $techniqueAuthor = '';
32
33
    #[ORM\Column(type: 'string', length: 60, options: ['default' => ''])]
34
    private string $techniqueDate = '';
35
36
    #[ORM\Column(type: 'string', options: ['default' => ''])]
37
    private string $format = '';
38
39
    #[ORM\Column(type: 'text', options: ['default' => ''])]
40
    private string $literature = '';
41
42
    #[ORM\Column(type: 'text', options: ['default' => ''])]
43
    private string $objectReference = '';
44
45
    #[ORM\Column(type: 'string', length: 10, options: ['default' => ''])]
46
    private string $page = '';
47
48
    #[ORM\Column(type: 'string', length: 10, options: ['default' => ''])]
49
    private string $figure = '';
50
51
    #[ORM\Column(name: '`table`', type: 'string', length: 10, options: ['default' => ''])]
52
    private string $table = '';
53
54
    #[ORM\Column(type: 'string', length: 30, options: ['default' => ''])]
55
    private string $isbn = '';
56
57
    #[ORM\Column(type: 'text', options: ['default' => ''])]
58
    private string $comment = '';
59
60
    #[ORM\Column(type: 'text', options: ['default' => ''])]
61
    private string $corpus = '';
62
63
    #[ORM\Column(type: 'string', options: ['default' => ''])]
64
    private string $rights = '';
65
66
    #[ORM\Column(type: 'string', options: ['default' => ''])]
67
    private string $muserisUrl = '';
68
69
    #[ORM\Column(type: 'string', options: ['default' => ''])]
70
    private string $muserisCote = '';
71
72
    #[ORM\Column(type: 'string', length: 60, options: ['default' => ''])]
73
    private string $productionPlace = '';
74
75
    #[ORM\Column(type: 'text', options: ['default' => ''])]
76
    private string $urlDescription = '';
77
78 3
    public function getAddition(): string
79
    {
80 3
        return $this->addition;
81
    }
82
83 8
    public function setAddition(string $addition): void
84
    {
85 8
        $this->addition = $addition;
86
    }
87
88 5
    public function getExpandedName(): string
89
    {
90 5
        return $this->expandedName;
91
    }
92
93 13
    public function setExpandedName(string $expandedName): void
94
    {
95 13
        $this->expandedName = Utility::sanitizeRichText($expandedName);
96
    }
97
98 4
    public function getMaterial(): string
99
    {
100 4
        return $this->material;
101
    }
102
103 8
    public function setMaterial(string $material): void
104
    {
105 8
        $this->material = $material;
106
    }
107
108 3
    public function getTechniqueAuthor(): string
109
    {
110 3
        return $this->techniqueAuthor;
111
    }
112
113 9
    public function setTechniqueAuthor(string $techniqueAuthor): void
114
    {
115 9
        $this->techniqueAuthor = $techniqueAuthor;
116
    }
117
118 3
    public function getTechniqueDate(): string
119
    {
120 3
        return $this->techniqueDate;
121
    }
122
123 8
    public function setTechniqueDate(string $techniqueDate): void
124
    {
125 8
        $this->techniqueDate = $techniqueDate;
126
    }
127
128 4
    public function getFormat(): string
129
    {
130 4
        return $this->format;
131
    }
132
133 8
    public function setFormat(string $format): void
134
    {
135 8
        $this->format = $format;
136
    }
137
138 3
    public function getLiterature(): string
139
    {
140 3
        return $this->literature;
141
    }
142
143 8
    public function setLiterature(string $literature): void
144
    {
145 8
        $this->literature = Utility::sanitizeRichText($literature);
146
    }
147
148 3
    public function getObjectReference(): string
149
    {
150 3
        return $this->objectReference;
151
    }
152
153 8
    public function setObjectReference(string $objectReference): void
154
    {
155 8
        $this->objectReference = $objectReference;
156
    }
157
158 3
    public function getPage(): string
159
    {
160 3
        return $this->page;
161
    }
162
163 8
    public function setPage(string $page): void
164
    {
165
        // Field is readonly and can only be emptied.
166 8
        if ($page !== '') {
167 8
            return;
168
        }
169
170
        $this->page = $page;
171
    }
172
173 3
    public function getFigure(): string
174
    {
175 3
        return $this->figure;
176
    }
177
178 8
    public function setFigure(string $figure): void
179
    {
180
        // Field is readonly and can only be emptied.
181 8
        if ($figure !== '') {
182 8
            return;
183
        }
184
185
        $this->figure = $figure;
186
    }
187
188 3
    public function getTable(): string
189
    {
190 3
        return $this->table;
191
    }
192
193 8
    public function setTable(string $table): void
194
    {
195
        // Field is readonly and can only be emptied.
196 8
        if ($table !== '') {
197 8
            return;
198
        }
199
200
        $this->table = $table;
201
    }
202
203 3
    public function getIsbn(): string
204
    {
205 3
        return $this->isbn;
206
    }
207
208
    public function setIsbn(string $isbn): void
209
    {
210
        $this->isbn = $isbn;
211
    }
212
213
    public function getComment(): string
214
    {
215
        return $this->comment;
216
    }
217
218 8
    public function setComment(string $comment): void
219
    {
220 8
        $this->comment = $comment;
221
    }
222
223
    public function getCorpus(): string
224
    {
225
        return $this->corpus;
226
    }
227
228 7
    public function setCorpus(string $corpus): void
229
    {
230 7
        $this->corpus = Utility::sanitizeRichText($corpus);
231
    }
232
233
    public function getRights(): string
234
    {
235
        return $this->rights;
236
    }
237
238 8
    public function setRights(string $rights): void
239
    {
240 8
        $this->rights = $rights;
241
    }
242
243
    public function getMuserisUrl(): string
244
    {
245
        return $this->muserisUrl;
246
    }
247
248 8
    public function setMuserisUrl(string $muserisUrl): void
249
    {
250 8
        $this->muserisUrl = $muserisUrl;
251
    }
252
253
    public function getMuserisCote(): string
254
    {
255
        return $this->muserisCote;
256
    }
257
258 8
    public function setMuserisCote(string $muserisCote): void
259
    {
260 8
        $this->muserisCote = $muserisCote;
261
    }
262
263 3
    public function getProductionPlace(): string
264
    {
265 3
        return $this->productionPlace;
266
    }
267
268 8
    public function setProductionPlace(string $productionPlace): void
269
    {
270 8
        $this->productionPlace = $productionPlace;
271
    }
272
273
    public function getUrlDescription(): string
274
    {
275
        return $this->urlDescription;
276
    }
277
278 7
    public function setUrlDescription(string $urlDescription): void
279
    {
280 7
        $this->urlDescription = Utility::sanitizeRichText($urlDescription);
281
    }
282
}
283