StringProperty::getEmptyString()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 1
c 1
b 0
f 1
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace LAG\AdminBundle\Metadata\Property;
6
7
#[\Attribute]
8
class StringProperty extends AbstractProperty
9
{
10
    public function __construct(
11
        string $name,
12
        ?string $propertyPath = null,
13
        ?string $label = null,
14
        ?string $template = '@LAGAdmin/grid/properties/string.html.twig',
15
        bool $mapped = true,
16
        bool $sortable = true,
17
        bool $translation = false,
18
        ?string $translationDomain = 'admin',
19
        array $attr = [],
20
        array $headerAttr = [],
21
        private int $length = 100,
22
        private string $replace = '...',
23
        private string $emptyString = '~',
24
    ) {
25
        parent::__construct(
26
            $name,
27
            $propertyPath,
28
            $label,
29
            $template,
30
            $mapped,
31
            $sortable,
32
            $translation,
33
            $translationDomain,
34
            $attr,
35
            $headerAttr,
36
        );
37
    }
38
39
    public function getLength(): int
40
    {
41
        return $this->length;
42
    }
43
44
    public function withLength(int $length): self
45
    {
46
        $self = clone $this;
47
        $self->length = $length;
48
49
        return $self;
50
    }
51
52
    public function getReplace(): string
53
    {
54
        return $this->replace;
55
    }
56
57
    public function withReplace(string $replace): self
58
    {
59
        $self = clone $this;
60
        $self->replace = $replace;
61
62
        return $self;
63
    }
64
65
    public function getEmptyString(): string
66
    {
67
        return $this->emptyString;
68
    }
69
70
    public function setEmptyString(string $emptyString): self
71
    {
72
        $self = clone $this;
73
        $self->emptyString = $emptyString;
74
75
        return $self;
76
    }
77
}
78