Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
65.00% covered (warning)
65.00%
52 / 80
77.50% covered (warning)
77.50%
31 / 40
CRAP
0.00% covered (danger)
0.00%
0 / 1
Textbaustein
65.00% covered (warning)
65.00%
52 / 80
77.50% covered (warning)
77.50%
31 / 40
141.71
0.00% covered (danger)
0.00%
0 / 1
 __construct
50.00% covered (danger)
50.00%
1 / 2
0.00% covered (danger)
0.00%
0 / 1
2.50
 getLfdnr
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getBetreff
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setBetreff
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 getBezeichnung
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setBezeichnung
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 getOrdner
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setOrdner
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 getNurlesen
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setNurlesen
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 getPrivat
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setPrivat
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 getTextunformatiert
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setTextunformatiert
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 getTextformatiert
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setTextformatiert
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 getAnlagen
0.00% covered (danger)
0.00%
0 / 6
0.00% covered (danger)
0.00%
0 / 1
6
 getAnlagenCsv
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setAnlagenCsv
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 setAnlagen
0.00% covered (danger)
0.00%
0 / 6
0.00% covered (danger)
0.00%
0 / 1
6
 addAnlage
0.00% covered (danger)
0.00%
0 / 5
0.00% covered (danger)
0.00%
0 / 1
6
 removeAnlage
0.00% covered (danger)
0.00%
0 / 5
0.00% covered (danger)
0.00%
0 / 1
6
 getAnzahlVerwendet
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setAnzahlVerwendet
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 incrementAnzahlVerwendet
0.00% covered (danger)
0.00%
0 / 2
0.00% covered (danger)
0.00%
0 / 1
2
 getZuletztverwendet
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setZuletztverwendet
75.00% covered (warning)
75.00%
3 / 4
0.00% covered (danger)
0.00%
0 / 1
2.06
 getVorlage
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setVorlage
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 isArchiv
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setArchiv
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 getGueltigbis
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setGueltigbis
75.00% covered (warning)
75.00%
3 / 4
0.00% covered (danger)
0.00%
0 / 1
2.06
 getFaq
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setFaq
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 getBemerkung
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setBemerkung
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 getBenutzer
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setBenutzer
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 __toString
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2
3declare(strict_types=1);
4
5namespace Satag\AmicronEntityBundle\Entity;
6
7use Doctrine\Common\Collections\ArrayCollection;
8use Doctrine\DBAL\Types\Types;
9use Doctrine\ORM\Mapping as ORM;
10use Satag\AmicronEntityBundle\Traits\BlameableEntity;
11use Satag\AmicronEntityBundle\Traits\BlameableEntityInterface;
12
13/**
14 * @see \Satag\AmicronEntityBundle\Tests\Entity\TextbausteinTest
15 */
16#[ORM\Entity]
17#[ORM\Table(name: 'TEXTE')]
18#[ORM\Index(columns: ['benutzerlfdnr'], name: 'TEXTE_BENUTZERLFDNR_FK')]
19class Textbaustein implements BlameableEntityInterface, \Stringable
20{
21    use BlameableEntity;
22
23    #[ORM\Column(name: 'lfdnr', type: Types::INTEGER, nullable: false)]
24    #[ORM\Id]
25    #[ORM\GeneratedValue(strategy: 'SEQUENCE')]
26    #[ORM\SequenceGenerator(sequenceName: 'GEN_LFDNR', allocationSize: 1, initialValue: 1)]
27    public private(set) ?int $lfdnr = null;
28
29    #[ORM\Column(name: 'betreff', type: Types::STRING, length: 255, nullable: true)]
30    private ?string $betreff = '';
31
32    #[ORM\Column(name: 'bezeichnung', type: Types::STRING, length: 150, nullable: false)]
33    private string $bezeichnung = '';
34
35    #[ORM\Column(name: 'ordner', type: Types::STRING, length: 300, nullable: true)]
36    private ?string $ordner = null;
37
38    #[ORM\Column(name: 'nurlesen', type: Types::BOOLEAN, length: 1, nullable: true)]
39    private ?bool $nurlesen = false;
40
41    #[ORM\Column(name: 'privat', type: Types::BOOLEAN, length: 1, nullable: true)]
42    private ?bool $privat = false;
43
44    #[ORM\Column(name: 'textunformatiert', type: Types::TEXT, nullable: true)]
45    private ?string $textunformatiert = null;
46
47    #[ORM\Column(name: 'textformatiert', type: Types::TEXT, nullable: true)]
48    private ?string $textformatiert = null;
49
50    #[ORM\Column(name: 'anlagen', type: Types::TEXT, nullable: true)]
51    private ?string $anlagen = null;
52
53    #[ORM\Column(name: 'verwendet', type: Types::INTEGER, nullable: true)]
54    private ?int $verwendet = 0;
55
56    #[ORM\Column(name: 'zuletztverwendet', type: Types::DATETIME_IMMUTABLE, nullable: true)]
57    private ?\DateTimeImmutable $zuletztverwendet = null;
58
59    #[ORM\Column(name: 'vorlage', type: Types::INTEGER, nullable: true)]
60    private ?int $vorlage = null;
61
62    #[ORM\Column(name: 'archiv', type: 'boolean_int', nullable: true)]
63    private bool $archiv = false;
64
65    #[ORM\Column(name: 'gueltigbis', type: Types::DATETIME_IMMUTABLE, nullable: true)]
66    private ?\DateTimeImmutable $gueltigbis = null;
67
68    #[ORM\Column(name: 'faq', type: Types::STRING, length: 255, nullable: true)]
69    private ?string $faq = null;
70
71    #[ORM\Column(name: 'bemerkung', type: Types::TEXT, nullable: true)]
72    private ?string $bemerkung = null;
73
74    #[ORM\ManyToOne(targetEntity: Benutzer::class)]
75    #[ORM\JoinColumn(name: 'benutzerlfdnr', referencedColumnName: 'lfdnr')]
76    private ?Benutzer $benutzer = null;
77
78    public function __construct(
79        ?string $bezeichnung = null
80    ) {
81        if ($bezeichnung) {
82            $this->bezeichnung = $bezeichnung;
83        }
84    }
85
86    public function getLfdnr(): ?int
87    {
88        return $this->lfdnr;
89    }
90
91    public function getBetreff(): ?string
92    {
93        return $this->betreff;
94    }
95
96    public function setBetreff(string $betreff): self
97    {
98        $this->betreff = $betreff;
99
100        return $this;
101    }
102
103    public function getBezeichnung(): string
104    {
105        return $this->bezeichnung;
106    }
107
108    public function setBezeichnung(string $bezeichnung): self
109    {
110        $this->bezeichnung = $bezeichnung;
111
112        return $this;
113    }
114
115    public function getOrdner(): ?string
116    {
117        return $this->ordner;
118    }
119
120    public function setOrdner(?string $ordner): self
121    {
122        $this->ordner = $ordner;
123
124        return $this;
125    }
126
127    public function getNurlesen(): ?bool
128    {
129        return $this->nurlesen;
130    }
131
132    public function setNurlesen(?bool $nurlesen): self
133    {
134        $this->nurlesen = $nurlesen;
135
136        return $this;
137    }
138
139    public function getPrivat(): ?bool
140    {
141        return $this->privat;
142    }
143
144    public function setPrivat(?bool $privat): self
145    {
146        $this->privat = $privat;
147
148        return $this;
149    }
150
151    public function getTextunformatiert(): ?string
152    {
153        return $this->textunformatiert;
154    }
155
156    public function setTextunformatiert(?string $textunformatiert): self
157    {
158        $this->textunformatiert = $textunformatiert;
159
160        return $this;
161    }
162
163    public function getTextformatiert(): ?string
164    {
165        return $this->textformatiert;
166    }
167
168    public function setTextformatiert(?string $textformatiert): self
169    {
170        $this->textformatiert = $textformatiert;
171
172        return $this;
173    }
174
175    /**
176     * @return ArrayCollection<int, string>
177     */
178    public function getAnlagen(): ArrayCollection
179    {
180        $anlagenCsv = $this->getAnlagenCsv();
181        $anlagenCsv = trim($anlagenCsv, '"');
182        if ($anlagenCsv !== '') {
183            $anlagen = explode('","', $anlagenCsv);
184        } else {
185            $anlagen = [];
186        }
187
188        return new ArrayCollection($anlagen);
189    }
190
191    public function getAnlagenCsv(): string
192    {
193        return (string) $this->anlagen;
194    }
195
196    public function setAnlagenCsv(?string $anlagenCsv): self
197    {
198        $this->anlagen = $anlagenCsv;
199
200        return $this;
201    }
202
203    /**
204     * @param ArrayCollection<int, string> $anlagen
205     */
206    public function setAnlagen(ArrayCollection $anlagen): self
207    {
208        $this->setAnlagenCsv(
209            $anlagen->count() > 0
210                ? '"' . implode('","', $anlagen->toArray()) . '"'
211                : null
212        );
213
214        return $this;
215    }
216
217    public function addAnlage(string $anlagenPfad): self
218    {
219        $anlagen = $this->getAnlagen();
220        if (!$anlagen->contains($anlagenPfad)) {
221            $anlagen->add($anlagenPfad);
222            $this->setAnlagen($anlagen);
223        }
224
225        return $this;
226    }
227
228    public function removeAnlage(string $anlagenPfad): self
229    {
230        $anlagen = $this->getAnlagen();
231        if ($anlagen->contains($anlagenPfad)) {
232            $anlagen->removeElement($anlagenPfad);
233            $this->setAnlagen($anlagen);
234        }
235
236        return $this;
237    }
238
239    public function getAnzahlVerwendet(): ?int
240    {
241        return $this->verwendet;
242    }
243
244    public function setAnzahlVerwendet(?int $verwendet): self
245    {
246        $this->verwendet = $verwendet;
247
248        return $this;
249    }
250
251    public function incrementAnzahlVerwendet(): self
252    {
253        $this->setAnzahlVerwendet($this->verwendet + 1);
254
255        return $this;
256    }
257
258    public function getZuletztverwendet(): ?\DateTimeImmutable
259    {
260        return $this->zuletztverwendet;
261    }
262
263    public function setZuletztverwendet(\DateTimeImmutable|\DateTime|null $zuletztverwendet): self
264    {
265        $this->zuletztverwendet = $zuletztverwendet instanceof \DateTime
266            ? \DateTimeImmutable::createFromMutable($zuletztverwendet)
267            : $zuletztverwendet;
268
269        return $this;
270    }
271
272    public function getVorlage(): ?int
273    {
274        return $this->vorlage;
275    }
276
277    public function setVorlage(?int $vorlage): self
278    {
279        $this->vorlage = $vorlage;
280
281        return $this;
282    }
283
284    public function isArchiv(): bool
285    {
286        return $this->archiv;
287    }
288
289    public function setArchiv(bool $archiv): self
290    {
291        $this->archiv = $archiv;
292
293        return $this;
294    }
295
296    public function getGueltigbis(): ?\DateTimeImmutable
297    {
298        return $this->gueltigbis;
299    }
300
301    public function setGueltigbis(\DateTimeImmutable|\DateTime|null $gueltigbis): self
302    {
303        $this->gueltigbis = $gueltigbis instanceof \DateTime
304            ? \DateTimeImmutable::createFromMutable($gueltigbis)
305            : $gueltigbis;
306
307        return $this;
308    }
309
310    public function getFaq(): ?string
311    {
312        return $this->faq;
313    }
314
315    public function setFaq(?string $faq): self
316    {
317        $this->faq = $faq;
318
319        return $this;
320    }
321
322    public function getBemerkung(): ?string
323    {
324        return $this->bemerkung;
325    }
326
327    public function setBemerkung(?string $bemerkung): self
328    {
329        $this->bemerkung = $bemerkung;
330
331        return $this;
332    }
333
334    public function getBenutzer(): ?Benutzer
335    {
336        return $this->benutzer;
337    }
338
339    public function setBenutzer(?Benutzer $benutzer): self
340    {
341        $this->benutzer = $benutzer;
342
343        return $this;
344    }
345
346    public function __toString(): string
347    {
348        return \sprintf('\\\\bplate:%s (%s)', $this->lfdnr, $this->getBezeichnung());
349    }
350}