Filter   A
last analyzed

Complexity

Total Complexity 15

Size/Duplication

Total Lines 103
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 30
c 1
b 0
f 1
dl 0
loc 103
rs 10
wmc 15

15 Methods

Rating   Name   Duplication   Size   Complexity  
A withName() 0 6 1
A withFormType() 0 6 1
A withOperator() 0 6 1
A getPropertyPath() 0 3 1
A withData() 0 6 1
A getOperator() 0 3 1
A __construct() 0 9 1
A getName() 0 3 1
A getData() 0 3 1
A getFormType() 0 3 1
A withPropertyPath() 0 6 1
A getComparator() 0 3 1
A withComparator() 0 6 1
A withFormOptions() 0 6 1
A getFormOptions() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace LAG\AdminBundle\Metadata\Filter;
6
7
use Symfony\Component\Form\Extension\Core\Type\TextType;
8
9
#[\Attribute]
10
class Filter implements FilterInterface
11
{
12
    public function __construct(
13
        private string $name,
14
        private ?string $propertyPath = null,
15
        private string $comparator = '=',
16
        private string $operator = 'and',
17
        private mixed $data = null,
18
        private string $formType = TextType::class,
19
        private array $formOptions = [],
20
    ) {
21
    }
22
23
    public function getName(): string
24
    {
25
        return $this->name;
26
    }
27
28
    public function withName(string $name): self
29
    {
30
        $self = clone $this;
31
        $self->name = $name;
32
33
        return $self;
34
    }
35
36
    public function getPropertyPath(): ?string
37
    {
38
        return $this->propertyPath;
39
    }
40
41
    public function withPropertyPath(?string $propertyPath): self
42
    {
43
        $self = clone $this;
44
        $self->propertyPath = $propertyPath;
45
46
        return $self;
47
    }
48
49
    public function getComparator(): string
50
    {
51
        return $this->comparator;
52
    }
53
54
    public function withComparator(string $comparator): self
55
    {
56
        $self = clone $this;
57
        $self->comparator = $comparator;
58
59
        return $self;
60
    }
61
62
    public function getOperator(): string
63
    {
64
        return $this->operator;
65
    }
66
67
    public function withOperator(string $operator): self
68
    {
69
        $self = clone $this;
70
        $self->operator = $operator;
71
72
        return $self;
73
    }
74
75
    public function getData(): mixed
76
    {
77
        return $this->data;
78
    }
79
80
    public function withData(mixed $data): self
81
    {
82
        $self = clone $this;
83
        $self->data = $data;
84
85
        return $self;
86
    }
87
88
    public function getFormType(): string
89
    {
90
        return $this->formType;
91
    }
92
93
    public function withFormType(string $formType): FilterInterface
94
    {
95
        $self = clone $this;
96
        $self->formType = $formType;
97
98
        return $self;
99
    }
100
101
    public function getFormOptions(): array
102
    {
103
        return $this->formOptions;
104
    }
105
106
    public function withFormOptions(array $formOptions): FilterInterface
107
    {
108
        $self = clone $this;
109
        $self->formOptions = $formOptions;
110
111
        return $self;
112
    }
113
}
114