Operation::getIdentifiers()   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;
6
7
use LAG\AdminBundle\Bridge\Doctrine\ORM\State\ORMDataProcessor;
8
use LAG\AdminBundle\Bridge\Doctrine\ORM\State\ORMDataProvider;
9
use Symfony\Component\Validator\Constraints as Assert;
10
11
abstract class Operation implements OperationInterface
12
{
13
    private AdminResource $resource;
14
15
    public function __construct(
16
        #[Assert\NotBlank(message: 'The operation name should not be empty')]
17
        private ?string $name = null,
18
        #[Assert\Length(max: 255, maxMessage: 'The operation title should be shorter than 255 characters')]
19
        private ?string $title = null,
20
        private ?string $description = null,
21
        #[Assert\Length(max: 255, maxMessage: 'The operation icon should be shorter than 255 characters')]
22
        private ?string $icon = null,
23
        #[Assert\NotBlank(message: 'The operation template should not be empty')]
24
        private ?string $template = null,
25
        private ?array $permissions = [],
26
        #[Assert\NotBlank(message: 'The operation controller should not be empty')]
27
        private ?string $controller = null,
28
        #[Assert\NotBlank(message: 'The operation has an empty route')]
29
        private ?string $route = null,
30
        private ?array $routeParameters = null,
31
        private array $methods = [],
32
        private string $path = '/{resourceName}/{operationName}',
33
        private ?string $targetRoute = null,
34
        private ?array $targetRouteParameters = null,
35
        private array $properties = [],
36
        private ?string $formType = null,
37
        private array $formOptions = [],
38
        private string $processor = ORMDataProcessor::class,
39
        private string $provider = ORMDataProvider::class,
40
        private array $identifiers = ['id'],
41
        private ?array $contextualActions = null,
42
        private ?array $itemActions = null,
43
    ) {
44
    }
45
46
    public function getName(): ?string
47
    {
48
        return $this->name;
49
    }
50
51
    public function withName(?string $name): self
52
    {
53
        $self = clone $this;
54
        $self->name = $name;
55
56
        return $self;
57
    }
58
59
    public function getTitle(): ?string
60
    {
61
        return $this->title;
62
    }
63
64
    public function withTitle(?string $title): self
65
    {
66
        $self = clone $this;
67
        $self->title = $title;
68
69
        return $self;
70
    }
71
72
    public function getDescription(): ?string
73
    {
74
        return $this->description;
75
    }
76
77
    public function withDescription(?string $description): self
78
    {
79
        $self = clone $this;
80
        $self->description = $description;
81
82
        return $self;
83
    }
84
85
    public function getIcon(): ?string
86
    {
87
        return $this->icon;
88
    }
89
90
    public function withIcon(?string $icon): self
91
    {
92
        $self = clone $this;
93
        $self->icon = $icon;
94
95
        return $self;
96
    }
97
98
    public function getTemplate(): ?string
99
    {
100
        return $this->template;
101
    }
102
103
    public function withTemplate(?string $template): self
104
    {
105
        $self = clone $this;
106
        $self->template = $template;
107
108
        return $self;
109
    }
110
111
    public function getPermissions(): ?array
112
    {
113
        return $this->permissions;
114
    }
115
116
    public function withPermissions(?array $permissions): self
117
    {
118
        $self = clone $this;
119
        $self->permissions = $permissions;
120
121
        return $self;
122
    }
123
124
    public function getController(): ?string
125
    {
126
        return $this->controller;
127
    }
128
129
    public function withController(?string $controller): self
130
    {
131
        $self = clone $this;
132
        $self->controller = $controller;
133
134
        return $self;
135
    }
136
137
    public function getRoute(): ?string
138
    {
139
        return $this->route;
140
    }
141
142
    public function withRoute(?string $route): self
143
    {
144
        $self = clone $this;
145
        $self->route = $route;
146
147
        return $self;
148
    }
149
150
    public function getRouteParameters(): ?array
151
    {
152
        return $this->routeParameters;
153
    }
154
155
    public function withRouteParameters(?array $routeParameters): self
156
    {
157
        $self = clone $this;
158
        $self->routeParameters = $routeParameters;
159
160
        return $self;
161
    }
162
163
    public function getPath(): string
164
    {
165
        return $this->path;
166
    }
167
168
    public function withPath(string $path): self
169
    {
170
        $self = clone $this;
171
        $self->path = $path;
172
173
        return $self;
174
    }
175
176
    public function getTargetRoute(): ?string
177
    {
178
        return $this->targetRoute;
179
    }
180
181
    public function withTargetRoute(?string $targetRoute): self
182
    {
183
        $self = clone $this;
184
        $self->targetRoute = $targetRoute;
185
186
        return $self;
187
    }
188
189
    public function getTargetRouteParameters(): ?array
190
    {
191
        return $this->targetRouteParameters;
192
    }
193
194
    public function withTargetRouteParameters(?array $targetRouteParameters): self
195
    {
196
        $self = clone $this;
197
        $self->targetRouteParameters = $targetRouteParameters;
198
199
        return $self;
200
    }
201
202
    public function getProperties(): array
203
    {
204
        return $this->properties;
205
    }
206
207
    public function withProperties(array $properties): self
208
    {
209
        $self = clone $this;
210
        $self->properties = $properties;
211
212
        return $self;
213
    }
214
215
    public function getFormType(): ?string
216
    {
217
        return $this->formType;
218
    }
219
220
    public function withFormType(?string $formType): self
221
    {
222
        $self = clone $this;
223
        $self->formType = $formType;
224
225
        return $self;
226
    }
227
228
    public function getFormOptions(): array
229
    {
230
        return $this->formOptions;
231
    }
232
233
    public function withFormOptions(array $formOptions): self
234
    {
235
        $self = clone $this;
236
        $self->formOptions = $formOptions;
237
238
        return $self;
239
    }
240
241
    public function getProcessor(): string
242
    {
243
        return $this->processor;
244
    }
245
246
    public function withProcessor(string $processor): self
247
    {
248
        $self = clone $this;
249
        $self->processor = $processor;
250
251
        return $self;
252
    }
253
254
    public function getProvider(): string
255
    {
256
        return $this->provider;
257
    }
258
259
    public function withProvider(string $provider): self
260
    {
261
        $self = clone $this;
262
        $self->provider = $provider;
263
264
        return $self;
265
    }
266
267
    public function getMethods(): array
268
    {
269
        return $this->methods;
270
    }
271
272
    public function withMethods(array $methods): self
273
    {
274
        $self = clone $this;
275
        $self->methods = $methods;
276
277
        return $self;
278
    }
279
280
    public function getIdentifiers(): array
281
    {
282
        return $this->identifiers;
283
    }
284
285
    public function withIdentifiers(array $identifiers): self
286
    {
287
        $self = clone $this;
288
        $self->identifiers = $identifiers;
289
290
        return $self;
291
    }
292
293
    public function getResource(): AdminResource
294
    {
295
        return $this->resource;
296
    }
297
298
    public function withResource(AdminResource $resource): self
299
    {
300
        $self = clone $this;
301
        $self->resource = $resource;
302
303
        return $self;
304
    }
305
306
    public function getContextualActions(): ?array
307
    {
308
        return $this->contextualActions;
309
    }
310
311
    public function withContextualActions(array $contextualActions): self
312
    {
313
        $self = clone $this;
314
        $self->contextualActions = $contextualActions;
315
316
        return $self;
317
    }
318
319
    public function getItemActions(): ?array
320
    {
321
        return $this->itemActions;
322
    }
323
324
    public function withItemActions(array $itemActions): self
325
    {
326
        $self = clone $this;
327
        $self->itemActions = $itemActions;
328
329
        return $self;
330
    }
331
}
332