• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

api-platform / core / 4498909317

pending completion
4498909317

push

github

soyuka
Merge 3.1

364 of 364 new or added lines in 61 files covered. (100.0%)

10781 of 17989 relevant lines covered (59.93%)

11.36 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

82.35
/src/Metadata/Metadata.php
1
<?php
2

3
/*
4
 * This file is part of the API Platform project.
5
 *
6
 * (c) Kévin Dunglas <dunglas@gmail.com>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11

12
declare(strict_types=1);
13

14
namespace ApiPlatform\Metadata;
15

16
use ApiPlatform\State\OptionsInterface;
17

18
/**
19
 * @internal
20
 */
21
abstract class Metadata
22
{
23
    /**
24
     * @param string|null $deprecationReason       https://api-platform.com/docs/core/deprecations/#deprecating-resource-classes-operations-and-properties
25
     * @param string|null $security                https://api-platform.com/docs/core/security
26
     * @param string|null $securityPostDenormalize https://api-platform.com/docs/core/security/#executing-access-control-rules-after-denormalization
27
     */
28
    public function __construct(
29
        protected ?string $shortName = null,
30
        protected ?string $class = null,
31
        protected ?string $description = null,
32
        protected ?int $urlGenerationStrategy = null,
33
        protected ?string $deprecationReason = null,
34
        protected ?array $normalizationContext = null,
35
        protected ?array $denormalizationContext = null,
36
        protected ?bool $collectDenormalizationErrors = null,
37
        protected ?array $validationContext = null,
38
        protected ?array $filters = null,
39
        protected ?bool $elasticsearch = null,
40
        protected $mercure = null,
41
        protected $messenger = null,
42
        protected $input = null,
43
        protected $output = null,
44
        protected ?array $order = null,
45
        protected ?bool $fetchPartial = null,
46
        protected ?bool $forceEager = null,
47
        protected ?bool $paginationEnabled = null,
48
        protected ?string $paginationType = null,
49
        protected ?int $paginationItemsPerPage = null,
50
        protected ?int $paginationMaximumItemsPerPage = null,
51
        protected ?bool $paginationPartial = null,
52
        protected ?bool $paginationClientEnabled = null,
53
        protected ?bool $paginationClientItemsPerPage = null,
54
        protected ?bool $paginationClientPartial = null,
55
        protected ?bool $paginationFetchJoinCollection = null,
56
        protected ?bool $paginationUseOutputWalkers = null,
57
        protected ?string $security = null,
58
        protected ?string $securityMessage = null,
59
        protected ?string $securityPostDenormalize = null,
60
        protected ?string $securityPostDenormalizeMessage = null,
61
        protected ?string $securityPostValidation = null,
62
        protected ?string $securityPostValidationMessage = null,
63
        protected $provider = null,
64
        protected $processor = null,
65
        protected ?OptionsInterface $stateOptions = null,
66
        protected array $extraProperties = []
67
    ) {
68
    }
451✔
69

70
    public function getShortName(): ?string
71
    {
72
        return $this->shortName;
147✔
73
    }
74

75
    public function withShortName(string $shortName): static
76
    {
77
        $self = clone $this;
124✔
78
        $self->shortName = $shortName;
124✔
79

80
        return $self;
124✔
81
    }
82

83
    public function getClass(): ?string
84
    {
85
        return $this->class;
71✔
86
    }
87

88
    public function withClass(string $class): static
89
    {
90
        $self = clone $this;
56✔
91
        $self->class = $class;
56✔
92

93
        return $self;
56✔
94
    }
95

96
    public function getDescription(): ?string
97
    {
98
        return $this->description;
63✔
99
    }
100

101
    public function withDescription(?string $description = null): static
102
    {
103
        $self = clone $this;
20✔
104
        $self->description = $description;
20✔
105

106
        return $self;
20✔
107
    }
108

109
    public function getUrlGenerationStrategy(): ?int
110
    {
111
        return $this->urlGenerationStrategy;
46✔
112
    }
113

114
    public function withUrlGenerationStrategy(int $urlGenerationStrategy): static
115
    {
116
        $self = clone $this;
1✔
117
        $self->urlGenerationStrategy = $urlGenerationStrategy;
1✔
118

119
        return $self;
1✔
120
    }
121

122
    public function getDeprecationReason(): ?string
123
    {
124
        return $this->deprecationReason;
48✔
125
    }
126

127
    public function withDeprecationReason($deprecationReason): static
128
    {
129
        $self = clone $this;
1✔
130
        $self->deprecationReason = $deprecationReason;
1✔
131

132
        return $self;
1✔
133
    }
134

135
    public function getNormalizationContext(): ?array
136
    {
137
        return $this->normalizationContext;
102✔
138
    }
139

140
    public function withNormalizationContext(array $normalizationContext): static
141
    {
142
        $self = clone $this;
22✔
143
        $self->normalizationContext = $normalizationContext;
22✔
144

145
        return $self;
22✔
146
    }
147

148
    public function getDenormalizationContext(): ?array
149
    {
150
        return $this->denormalizationContext;
81✔
151
    }
152

153
    public function withDenormalizationContext(array $denormalizationContext): static
154
    {
155
        $self = clone $this;
6✔
156
        $self->denormalizationContext = $denormalizationContext;
6✔
157

158
        return $self;
6✔
159
    }
160

161
    public function getCollectDenormalizationErrors(): ?bool
162
    {
163
        return $this->collectDenormalizationErrors;
25✔
164
    }
165

166
    public function withCollectDenormalizationErrors(bool $collectDenormalizationErrors = null): static
167
    {
168
        $self = clone $this;
2✔
169
        $self->collectDenormalizationErrors = $collectDenormalizationErrors;
2✔
170

171
        return $self;
2✔
172
    }
173

174
    public function getValidationContext(): ?array
175
    {
176
        return $this->validationContext;
35✔
177
    }
178

179
    public function withValidationContext(array $validationContext): static
180
    {
181
        $self = clone $this;
2✔
182
        $self->validationContext = $validationContext;
2✔
183

184
        return $self;
2✔
185
    }
186

187
    /**
188
     * @return string[]|null
189
     */
190
    public function getFilters(): ?array
191
    {
192
        return $this->filters;
52✔
193
    }
194

195
    public function withFilters(array $filters): static
196
    {
197
        $self = clone $this;
9✔
198
        $self->filters = $filters;
9✔
199

200
        return $self;
9✔
201
    }
202

203
    /**
204
     * @deprecated this will be removed in v4
205
     */
206
    public function getElasticsearch(): ?bool
207
    {
208
        return $this->elasticsearch;
16✔
209
    }
210

211
    /**
212
     * @deprecated this will be removed in v4
213
     */
214
    public function withElasticsearch(bool $elasticsearch): static
215
    {
216
        $self = clone $this;
1✔
217
        $self->elasticsearch = $elasticsearch;
1✔
218

219
        return $self;
1✔
220
    }
221

222
    /**
223
     * @return array|bool|mixed|null
224
     */
225
    public function getMercure()
226
    {
227
        return $this->mercure;
36✔
228
    }
229

230
    public function withMercure($mercure): static
231
    {
232
        $self = clone $this;
8✔
233
        $self->mercure = $mercure;
8✔
234

235
        return $self;
8✔
236
    }
237

238
    public function getMessenger()
239
    {
240
        return $this->messenger;
10✔
241
    }
242

243
    public function withMessenger($messenger): static
244
    {
245
        $self = clone $this;
×
246
        $self->messenger = $messenger;
×
247

248
        return $self;
×
249
    }
250

251
    public function getInput()
252
    {
253
        return $this->input;
41✔
254
    }
255

256
    public function withInput($input): static
257
    {
258
        $self = clone $this;
24✔
259
        $self->input = $input;
24✔
260

261
        return $self;
24✔
262
    }
263

264
    public function getOutput()
265
    {
266
        return $this->output;
69✔
267
    }
268

269
    public function withOutput($output): static
270
    {
271
        $self = clone $this;
12✔
272
        $self->output = $output;
12✔
273

274
        return $self;
12✔
275
    }
276

277
    public function getOrder(): ?array
278
    {
279
        return $this->order;
23✔
280
    }
281

282
    public function withOrder(array $order): static
283
    {
284
        $self = clone $this;
3✔
285
        $self->order = $order;
3✔
286

287
        return $self;
3✔
288
    }
289

290
    public function getFetchPartial(): ?bool
291
    {
292
        return $this->fetchPartial;
37✔
293
    }
294

295
    public function withFetchPartial(bool $fetchPartial): static
296
    {
297
        $self = clone $this;
×
298
        $self->fetchPartial = $fetchPartial;
×
299

300
        return $self;
×
301
    }
302

303
    public function getForceEager(): ?bool
304
    {
305
        return $this->forceEager;
51✔
306
    }
307

308
    public function withForceEager(bool $forceEager): static
309
    {
310
        $self = clone $this;
1✔
311
        $self->forceEager = $forceEager;
1✔
312

313
        return $self;
1✔
314
    }
315

316
    public function getPaginationEnabled(): ?bool
317
    {
318
        return $this->paginationEnabled;
53✔
319
    }
320

321
    public function withPaginationEnabled(bool $paginationEnabled): static
322
    {
323
        $self = clone $this;
×
324
        $self->paginationEnabled = $paginationEnabled;
×
325

326
        return $self;
×
327
    }
328

329
    public function getPaginationType(): ?string
330
    {
331
        return $this->paginationType;
30✔
332
    }
333

334
    public function withPaginationType(string $paginationType): static
335
    {
336
        $self = clone $this;
2✔
337
        $self->paginationType = $paginationType;
2✔
338

339
        return $self;
2✔
340
    }
341

342
    public function getPaginationItemsPerPage(): ?int
343
    {
344
        return $this->paginationItemsPerPage;
28✔
345
    }
346

347
    public function withPaginationItemsPerPage(int $paginationItemsPerPage): static
348
    {
349
        $self = clone $this;
3✔
350
        $self->paginationItemsPerPage = $paginationItemsPerPage;
3✔
351

352
        return $self;
3✔
353
    }
354

355
    public function getPaginationMaximumItemsPerPage(): ?int
356
    {
357
        return $this->paginationMaximumItemsPerPage;
21✔
358
    }
359

360
    public function withPaginationMaximumItemsPerPage(int $paginationMaximumItemsPerPage): static
361
    {
362
        $self = clone $this;
×
363
        $self->paginationMaximumItemsPerPage = $paginationMaximumItemsPerPage;
×
364

365
        return $self;
×
366
    }
367

368
    public function getPaginationPartial(): ?bool
369
    {
370
        return $this->paginationPartial;
28✔
371
    }
372

373
    public function withPaginationPartial(bool $paginationPartial): static
374
    {
375
        $self = clone $this;
1✔
376
        $self->paginationPartial = $paginationPartial;
1✔
377

378
        return $self;
1✔
379
    }
380

381
    public function getPaginationClientEnabled(): ?bool
382
    {
383
        return $this->paginationClientEnabled;
30✔
384
    }
385

386
    public function withPaginationClientEnabled(bool $paginationClientEnabled): static
387
    {
388
        $self = clone $this;
3✔
389
        $self->paginationClientEnabled = $paginationClientEnabled;
3✔
390

391
        return $self;
3✔
392
    }
393

394
    public function getPaginationClientItemsPerPage(): ?bool
395
    {
396
        return $this->paginationClientItemsPerPage;
28✔
397
    }
398

399
    public function withPaginationClientItemsPerPage(bool $paginationClientItemsPerPage): static
400
    {
401
        $self = clone $this;
3✔
402
        $self->paginationClientItemsPerPage = $paginationClientItemsPerPage;
3✔
403

404
        return $self;
3✔
405
    }
406

407
    public function getPaginationClientPartial(): ?bool
408
    {
409
        return $this->paginationClientPartial;
28✔
410
    }
411

412
    public function withPaginationClientPartial(bool $paginationClientPartial): static
413
    {
414
        $self = clone $this;
3✔
415
        $self->paginationClientPartial = $paginationClientPartial;
3✔
416

417
        return $self;
3✔
418
    }
419

420
    public function getPaginationFetchJoinCollection(): ?bool
421
    {
422
        return $this->paginationFetchJoinCollection;
28✔
423
    }
424

425
    public function withPaginationFetchJoinCollection(bool $paginationFetchJoinCollection): static
426
    {
427
        $self = clone $this;
×
428
        $self->paginationFetchJoinCollection = $paginationFetchJoinCollection;
×
429

430
        return $self;
×
431
    }
432

433
    public function getPaginationUseOutputWalkers(): ?bool
434
    {
435
        return $this->paginationUseOutputWalkers;
28✔
436
    }
437

438
    public function withPaginationUseOutputWalkers(bool $paginationUseOutputWalkers): static
439
    {
440
        $self = clone $this;
×
441
        $self->paginationUseOutputWalkers = $paginationUseOutputWalkers;
×
442

443
        return $self;
×
444
    }
445

446
    public function getSecurity(): ?string
447
    {
448
        return $this->security;
33✔
449
    }
450

451
    public function withSecurity($security): static
452
    {
453
        $self = clone $this;
4✔
454
        $self->security = $security;
4✔
455

456
        return $self;
4✔
457
    }
458

459
    public function getSecurityMessage(): ?string
460
    {
461
        return $this->securityMessage;
29✔
462
    }
463

464
    public function withSecurityMessage(string $securityMessage): static
465
    {
466
        $self = clone $this;
×
467
        $self->securityMessage = $securityMessage;
×
468

469
        return $self;
×
470
    }
471

472
    public function getSecurityPostDenormalize(): ?string
473
    {
474
        return $this->securityPostDenormalize;
29✔
475
    }
476

477
    public function withSecurityPostDenormalize($securityPostDenormalize): static
478
    {
479
        $self = clone $this;
3✔
480
        $self->securityPostDenormalize = $securityPostDenormalize;
3✔
481

482
        return $self;
3✔
483
    }
484

485
    public function getSecurityPostDenormalizeMessage(): ?string
486
    {
487
        return $this->securityPostDenormalizeMessage;
25✔
488
    }
489

490
    public function withSecurityPostDenormalizeMessage(string $securityPostDenormalizeMessage): static
491
    {
492
        $self = clone $this;
×
493
        $self->securityPostDenormalizeMessage = $securityPostDenormalizeMessage;
×
494

495
        return $self;
×
496
    }
497

498
    public function getSecurityPostValidation(): ?string
499
    {
500
        return $this->securityPostValidation;
29✔
501
    }
502

503
    public function withSecurityPostValidation(?string $securityPostValidation = null): static
504
    {
505
        $self = clone $this;
3✔
506
        $self->securityPostValidation = $securityPostValidation;
3✔
507

508
        return $self;
3✔
509
    }
510

511
    public function getSecurityPostValidationMessage(): ?string
512
    {
513
        return $this->securityPostValidationMessage;
25✔
514
    }
515

516
    public function withSecurityPostValidationMessage(?string $securityPostValidationMessage = null): static
517
    {
518
        $self = clone $this;
×
519
        $self->securityPostValidationMessage = $securityPostValidationMessage;
×
520

521
        return $self;
×
522
    }
523

524
    public function getProcessor(): callable|string|null
525
    {
526
        return $this->processor;
25✔
527
    }
528

529
    public function withProcessor(callable|string|null $processor): static
530
    {
531
        $self = clone $this;
14✔
532
        $self->processor = $processor;
14✔
533

534
        return $self;
14✔
535
    }
536

537
    public function getProvider(): callable|string|null
538
    {
539
        return $this->provider;
34✔
540
    }
541

542
    public function withProvider(callable|string|null $provider): static
543
    {
544
        $self = clone $this;
12✔
545
        $self->provider = $provider;
12✔
546

547
        return $self;
12✔
548
    }
549

550
    public function getStateOptions(): ?OptionsInterface
551
    {
552
        return $this->stateOptions;
49✔
553
    }
554

555
    public function withStateOptions(?OptionsInterface $stateOptions): static
556
    {
557
        $self = clone $this;
1✔
558
        $self->stateOptions = $stateOptions;
1✔
559

560
        return $self;
1✔
561
    }
562

563
    public function getExtraProperties(): ?array
564
    {
565
        return $this->extraProperties;
36✔
566
    }
567

568
    public function withExtraProperties(array $extraProperties = []): static
569
    {
570
        $self = clone $this;
11✔
571
        $self->extraProperties = $extraProperties;
11✔
572

573
        return $self;
11✔
574
    }
575
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc