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

api-platform / core / 19438754788

17 Nov 2025 05:34PM UTC coverage: 0.0%. Remained the same
19438754788

push

github

soyuka
Merge 4.2

0 of 95 new or added lines in 28 files covered. (0.0%)

19 existing lines in 18 files now uncovered.

0 of 57020 relevant lines covered (0.0%)

0.0 hits per line

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

0.0
/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
 * @psalm-inheritors ApiResource|Operation
20
 */
21
abstract class Metadata
22
{
23
    protected ?Parameters $parameters = null;
24

25
    /**
26
     * @param class-string                                                                      $class
27
     * @param string|null                                                                       $deprecationReason       https://api-platform.com/docs/core/deprecations/#deprecating-resource-classes-operations-and-properties
28
     * @param string|\Stringable|null                                                           $security                https://api-platform.com/docs/core/security
29
     * @param string|\Stringable|null                                                           $securityPostDenormalize https://api-platform.com/docs/core/security/#executing-access-control-rules-after-denormalization
30
     * @param mixed|null                                                                        $mercure
31
     * @param mixed|null                                                                        $messenger
32
     * @param mixed|null                                                                        $input
33
     * @param mixed|null                                                                        $output
34
     * @param mixed|null                                                                        $provider
35
     * @param mixed|null                                                                        $processor
36
     * @param Parameters|array<string, Parameter>                                               $parameters
37
     * @param callable|string|array<string, \Illuminate\Contracts\Validation\Rule|array|string> $rules                   Laravel rules can be a FormRequest class, a callable or an array of rules
38
     */
39
    public function __construct(
40
        protected ?string $shortName = null,
41
        protected ?string $class = null,
42
        protected ?string $description = null,
43
        protected ?int $urlGenerationStrategy = null,
44
        protected ?string $deprecationReason = null,
45
        protected ?array $normalizationContext = null,
46
        protected ?array $denormalizationContext = null,
47
        protected ?bool $collectDenormalizationErrors = null,
48
        protected ?array $validationContext = null,
49
        protected ?array $filters = null,
50
        protected $mercure = null,
51
        protected $messenger = null,
52
        protected $input = null,
53
        protected $output = null,
54
        protected ?array $order = null,
55
        protected ?bool $fetchPartial = null,
56
        protected ?bool $forceEager = null,
57
        protected ?bool $paginationEnabled = null,
58
        protected ?string $paginationType = null,
59
        protected ?int $paginationItemsPerPage = null,
60
        protected ?int $paginationMaximumItemsPerPage = null,
61
        protected ?bool $paginationPartial = null,
62
        protected ?bool $paginationClientEnabled = null,
63
        protected ?bool $paginationClientItemsPerPage = null,
64
        protected ?bool $paginationClientPartial = null,
65
        protected ?bool $paginationFetchJoinCollection = null,
66
        protected ?bool $paginationUseOutputWalkers = null,
67
        protected string|\Stringable|null $security = null,
68
        protected ?string $securityMessage = null,
69
        protected string|\Stringable|null $securityPostDenormalize = null,
70
        protected ?string $securityPostDenormalizeMessage = null,
71
        protected string|\Stringable|null $securityPostValidation = null,
72
        protected ?string $securityPostValidationMessage = null,
73
        protected $provider = null,
74
        protected $processor = null,
75
        protected ?OptionsInterface $stateOptions = null,
76
        array|Parameters|null $parameters = null,
77
        protected mixed $rules = null,
78
        protected ?string $policy = null,
79
        protected array|string|null $middleware = null,
80
        protected ?bool $queryParameterValidationEnabled = null,
81
        protected ?bool $strictQueryParameterValidation = null,
82
        protected ?bool $hideHydraOperation = null,
83
        protected ?bool $jsonStream = null,
84
        protected ?bool $map = null,
85
        protected array $extraProperties = [],
86
    ) {
87
        if (\is_array($parameters) && $parameters) {
×
88
            $parameters = new Parameters($parameters);
×
89
        }
90

91
        $this->parameters = $parameters;
×
92
    }
93

94
    public function canMap(): ?bool
95
    {
NEW
96
        return $this->map;
×
97
    }
98

99
    public function withMap(bool $map): static
100
    {
NEW
101
        $self = clone $this;
×
NEW
102
        $self->map = $map;
×
103

NEW
104
        return $self;
×
105
    }
106

107
    public function getShortName(): ?string
108
    {
109
        return $this->shortName;
×
110
    }
111

112
    public function withShortName(string $shortName): static
113
    {
114
        $self = clone $this;
×
115
        $self->shortName = $shortName;
×
116

117
        return $self;
×
118
    }
119

120
    /**
121
     * @return class-string|null
122
     */
123
    public function getClass(): ?string
124
    {
125
        return $this->class;
×
126
    }
127

128
    /**
129
     * @param class-string $class
130
     */
131
    public function withClass(string $class): static
132
    {
133
        $self = clone $this;
×
134
        $self->class = $class;
×
135

136
        return $self;
×
137
    }
138

139
    public function getDescription(): ?string
140
    {
141
        return $this->description;
×
142
    }
143

144
    public function withDescription(?string $description = null): static
145
    {
146
        $self = clone $this;
×
147
        $self->description = $description;
×
148

149
        return $self;
×
150
    }
151

152
    public function getUrlGenerationStrategy(): ?int
153
    {
154
        return $this->urlGenerationStrategy;
×
155
    }
156

157
    public function withUrlGenerationStrategy(int $urlGenerationStrategy): static
158
    {
159
        $self = clone $this;
×
160
        $self->urlGenerationStrategy = $urlGenerationStrategy;
×
161

162
        return $self;
×
163
    }
164

165
    public function getDeprecationReason(): ?string
166
    {
167
        return $this->deprecationReason;
×
168
    }
169

170
    /**
171
     * @param string $deprecationReason
172
     */
173
    public function withDeprecationReason($deprecationReason): static
174
    {
175
        $self = clone $this;
×
176
        $self->deprecationReason = $deprecationReason;
×
177

178
        return $self;
×
179
    }
180

181
    public function getNormalizationContext(): ?array
182
    {
183
        return $this->normalizationContext;
×
184
    }
185

186
    public function withNormalizationContext(array $normalizationContext): static
187
    {
188
        $self = clone $this;
×
189
        $self->normalizationContext = $normalizationContext;
×
190

191
        return $self;
×
192
    }
193

194
    public function getDenormalizationContext(): ?array
195
    {
196
        return $this->denormalizationContext;
×
197
    }
198

199
    public function withDenormalizationContext(array $denormalizationContext): static
200
    {
201
        $self = clone $this;
×
202
        $self->denormalizationContext = $denormalizationContext;
×
203

204
        return $self;
×
205
    }
206

207
    public function getCollectDenormalizationErrors(): ?bool
208
    {
209
        return $this->collectDenormalizationErrors;
×
210
    }
211

212
    public function withCollectDenormalizationErrors(?bool $collectDenormalizationErrors = null): static
213
    {
214
        $self = clone $this;
×
215
        $self->collectDenormalizationErrors = $collectDenormalizationErrors;
×
216

217
        return $self;
×
218
    }
219

220
    public function getValidationContext(): ?array
221
    {
222
        return $this->validationContext;
×
223
    }
224

225
    public function withValidationContext(array $validationContext): static
226
    {
227
        $self = clone $this;
×
228
        $self->validationContext = $validationContext;
×
229

230
        return $self;
×
231
    }
232

233
    /**
234
     * @return string[]|null
235
     */
236
    public function getFilters(): ?array
237
    {
238
        return $this->filters;
×
239
    }
240

241
    public function withFilters(array $filters): static
242
    {
243
        $self = clone $this;
×
244
        $self->filters = $filters;
×
245

246
        return $self;
×
247
    }
248

249
    public function getMercure(): mixed
250
    {
251
        return $this->mercure;
×
252
    }
253

254
    public function withMercure(mixed $mercure): static
255
    {
256
        $self = clone $this;
×
257
        $self->mercure = $mercure;
×
258

259
        return $self;
×
260
    }
261

262
    public function getMessenger(): mixed
263
    {
264
        return $this->messenger;
×
265
    }
266

267
    public function withMessenger(mixed $messenger): static
268
    {
269
        $self = clone $this;
×
270
        $self->messenger = $messenger;
×
271

272
        return $self;
×
273
    }
274

275
    public function getInput(): mixed
276
    {
277
        return $this->input;
×
278
    }
279

280
    public function withInput(mixed $input): static
281
    {
282
        $self = clone $this;
×
283
        $self->input = $input;
×
284

285
        return $self;
×
286
    }
287

288
    public function getOutput(): mixed
289
    {
290
        return $this->output;
×
291
    }
292

293
    public function withOutput(mixed $output): static
294
    {
295
        $self = clone $this;
×
296
        $self->output = $output;
×
297

298
        return $self;
×
299
    }
300

301
    public function getOrder(): ?array
302
    {
303
        return $this->order;
×
304
    }
305

306
    public function withOrder(array $order): static
307
    {
308
        $self = clone $this;
×
309
        $self->order = $order;
×
310

311
        return $self;
×
312
    }
313

314
    public function getFetchPartial(): ?bool
315
    {
316
        return $this->fetchPartial;
×
317
    }
318

319
    public function withFetchPartial(bool $fetchPartial): static
320
    {
321
        $self = clone $this;
×
322
        $self->fetchPartial = $fetchPartial;
×
323

324
        return $self;
×
325
    }
326

327
    public function getForceEager(): ?bool
328
    {
329
        return $this->forceEager;
×
330
    }
331

332
    public function withForceEager(bool $forceEager): static
333
    {
334
        $self = clone $this;
×
335
        $self->forceEager = $forceEager;
×
336

337
        return $self;
×
338
    }
339

340
    public function getPaginationEnabled(): ?bool
341
    {
342
        return $this->paginationEnabled;
×
343
    }
344

345
    public function withPaginationEnabled(bool $paginationEnabled): static
346
    {
347
        $self = clone $this;
×
348
        $self->paginationEnabled = $paginationEnabled;
×
349

350
        return $self;
×
351
    }
352

353
    public function getPaginationType(): ?string
354
    {
355
        return $this->paginationType;
×
356
    }
357

358
    public function withPaginationType(string $paginationType): static
359
    {
360
        $self = clone $this;
×
361
        $self->paginationType = $paginationType;
×
362

363
        return $self;
×
364
    }
365

366
    public function getPaginationItemsPerPage(): ?int
367
    {
368
        return $this->paginationItemsPerPage;
×
369
    }
370

371
    public function withPaginationItemsPerPage(int $paginationItemsPerPage): static
372
    {
373
        $self = clone $this;
×
374
        $self->paginationItemsPerPage = $paginationItemsPerPage;
×
375

376
        return $self;
×
377
    }
378

379
    public function getPaginationMaximumItemsPerPage(): ?int
380
    {
381
        return $this->paginationMaximumItemsPerPage;
×
382
    }
383

384
    public function withPaginationMaximumItemsPerPage(int $paginationMaximumItemsPerPage): static
385
    {
386
        $self = clone $this;
×
387
        $self->paginationMaximumItemsPerPage = $paginationMaximumItemsPerPage;
×
388

389
        return $self;
×
390
    }
391

392
    public function getPaginationPartial(): ?bool
393
    {
394
        return $this->paginationPartial;
×
395
    }
396

397
    public function withPaginationPartial(bool $paginationPartial): static
398
    {
399
        $self = clone $this;
×
400
        $self->paginationPartial = $paginationPartial;
×
401

402
        return $self;
×
403
    }
404

405
    public function getPaginationClientEnabled(): ?bool
406
    {
407
        return $this->paginationClientEnabled;
×
408
    }
409

410
    public function withPaginationClientEnabled(bool $paginationClientEnabled): static
411
    {
412
        $self = clone $this;
×
413
        $self->paginationClientEnabled = $paginationClientEnabled;
×
414

415
        return $self;
×
416
    }
417

418
    public function getPaginationClientItemsPerPage(): ?bool
419
    {
420
        return $this->paginationClientItemsPerPage;
×
421
    }
422

423
    public function withPaginationClientItemsPerPage(bool $paginationClientItemsPerPage): static
424
    {
425
        $self = clone $this;
×
426
        $self->paginationClientItemsPerPage = $paginationClientItemsPerPage;
×
427

428
        return $self;
×
429
    }
430

431
    public function getPaginationClientPartial(): ?bool
432
    {
433
        return $this->paginationClientPartial;
×
434
    }
435

436
    public function withPaginationClientPartial(bool $paginationClientPartial): static
437
    {
438
        $self = clone $this;
×
439
        $self->paginationClientPartial = $paginationClientPartial;
×
440

441
        return $self;
×
442
    }
443

444
    public function getPaginationFetchJoinCollection(): ?bool
445
    {
446
        return $this->paginationFetchJoinCollection;
×
447
    }
448

449
    public function withPaginationFetchJoinCollection(bool $paginationFetchJoinCollection): static
450
    {
451
        $self = clone $this;
×
452
        $self->paginationFetchJoinCollection = $paginationFetchJoinCollection;
×
453

454
        return $self;
×
455
    }
456

457
    public function getPaginationUseOutputWalkers(): ?bool
458
    {
459
        return $this->paginationUseOutputWalkers;
×
460
    }
461

462
    public function withPaginationUseOutputWalkers(bool $paginationUseOutputWalkers): static
463
    {
464
        $self = clone $this;
×
465
        $self->paginationUseOutputWalkers = $paginationUseOutputWalkers;
×
466

467
        return $self;
×
468
    }
469

470
    public function getSecurity(): ?string
471
    {
472
        return $this->security instanceof \Stringable ? (string) $this->security : $this->security;
×
473
    }
474

475
    public function withSecurity(string|\Stringable|null $security = null): static
476
    {
477
        $self = clone $this;
×
478
        $self->security = $security;
×
479

480
        return $self;
×
481
    }
482

483
    public function getSecurityMessage(): ?string
484
    {
485
        return $this->securityMessage;
×
486
    }
487

488
    public function withSecurityMessage(string $securityMessage): static
489
    {
490
        $self = clone $this;
×
491
        $self->securityMessage = $securityMessage;
×
492

493
        return $self;
×
494
    }
495

496
    public function getSecurityPostDenormalize(): ?string
497
    {
498
        return $this->securityPostDenormalize instanceof \Stringable ? (string) $this->securityPostDenormalize : $this->securityPostDenormalize;
×
499
    }
500

501
    public function withSecurityPostDenormalize(string|\Stringable|null $securityPostDenormalize = null): static
502
    {
503
        $self = clone $this;
×
504
        $self->securityPostDenormalize = $securityPostDenormalize;
×
505

506
        return $self;
×
507
    }
508

509
    public function getSecurityPostDenormalizeMessage(): ?string
510
    {
511
        return $this->securityPostDenormalizeMessage;
×
512
    }
513

514
    public function withSecurityPostDenormalizeMessage(string $securityPostDenormalizeMessage): static
515
    {
516
        $self = clone $this;
×
517
        $self->securityPostDenormalizeMessage = $securityPostDenormalizeMessage;
×
518

519
        return $self;
×
520
    }
521

522
    public function getSecurityPostValidation(): ?string
523
    {
524
        return $this->securityPostValidation instanceof \Stringable ? (string) $this->securityPostValidation : $this->securityPostValidation;
×
525
    }
526

527
    public function withSecurityPostValidation(string|\Stringable|null $securityPostValidation = null): static
528
    {
529
        $self = clone $this;
×
530
        $self->securityPostValidation = $securityPostValidation;
×
531

532
        return $self;
×
533
    }
534

535
    public function getSecurityPostValidationMessage(): ?string
536
    {
537
        return $this->securityPostValidationMessage;
×
538
    }
539

540
    public function withSecurityPostValidationMessage(?string $securityPostValidationMessage = null): static
541
    {
542
        $self = clone $this;
×
543
        $self->securityPostValidationMessage = $securityPostValidationMessage;
×
544

545
        return $self;
×
546
    }
547

548
    public function getProcessor(): callable|string|null
549
    {
550
        return $this->processor;
×
551
    }
552

553
    public function withProcessor(callable|string|null $processor): static
554
    {
555
        $self = clone $this;
×
556
        $self->processor = $processor;
×
557

558
        return $self;
×
559
    }
560

561
    public function getProvider(): callable|string|null
562
    {
563
        return $this->provider;
×
564
    }
565

566
    public function withProvider(callable|string|null $provider): static
567
    {
568
        $self = clone $this;
×
569
        $self->provider = $provider;
×
570

571
        return $self;
×
572
    }
573

574
    public function getStateOptions(): ?OptionsInterface
575
    {
576
        return $this->stateOptions;
×
577
    }
578

579
    public function withStateOptions(?OptionsInterface $stateOptions): static
580
    {
581
        $self = clone $this;
×
582
        $self->stateOptions = $stateOptions;
×
583

584
        return $self;
×
585
    }
586

587
    /**
588
     * @return string|callable|array<string, \Illuminate\Contracts\Validation\Rule|array|string>
589
     */
590
    public function getRules(): mixed
591
    {
592
        return $this->rules;
×
593
    }
594

595
    /**
596
     * @param string|callable|array<string, \Illuminate\Contracts\Validation\Rule|array|string> $rules
597
     */
598
    public function withRules(mixed $rules): static
599
    {
600
        $self = clone $this;
×
601
        $self->rules = $rules;
×
602

603
        return $self;
×
604
    }
605

606
    public function getParameters(): ?Parameters
607
    {
608
        return $this->parameters;
×
609
    }
610

611
    public function withParameters(array|Parameters $parameters): static
612
    {
613
        $self = clone $this;
×
614
        $self->parameters = \is_array($parameters) ? new Parameters($parameters) : $parameters;
×
615

616
        return $self;
×
617
    }
618

619
    public function getQueryParameterValidationEnabled(): ?bool
620
    {
621
        return $this->queryParameterValidationEnabled;
×
622
    }
623

624
    public function withQueryParameterValidationEnabled(bool $queryParameterValidationEnabled): static
625
    {
626
        $self = clone $this;
×
627
        $self->queryParameterValidationEnabled = $queryParameterValidationEnabled;
×
628

629
        return $self;
×
630
    }
631

632
    public function getPolicy(): ?string
633
    {
634
        return $this->policy;
×
635
    }
636

637
    public function withPolicy(string $policy): static
638
    {
639
        $self = clone $this;
×
640
        $self->policy = $policy;
×
641

642
        return $self;
×
643
    }
644

645
    public function getMiddleware(): mixed
646
    {
647
        return $this->middleware;
×
648
    }
649

650
    public function withMiddleware(string|array $middleware): static
651
    {
652
        $self = clone $this;
×
653
        $self->middleware = $middleware;
×
654

655
        return $self;
×
656
    }
657

658
    public function getExtraProperties(): ?array
659
    {
660
        return $this->extraProperties;
×
661
    }
662

663
    public function withExtraProperties(array $extraProperties = []): static
664
    {
665
        $self = clone $this;
×
666
        $self->extraProperties = $extraProperties;
×
667

668
        return $self;
×
669
    }
670

671
    public function getStrictQueryParameterValidation(): ?bool
672
    {
673
        return $this->strictQueryParameterValidation;
×
674
    }
675

676
    public function withStrictQueryParameterValidation(bool $strictQueryParameterValidation): static
677
    {
678
        $self = clone $this;
×
679
        $self->strictQueryParameterValidation = $strictQueryParameterValidation;
×
680

681
        return $self;
×
682
    }
683

684
    public function getHideHydraOperation(): ?bool
685
    {
686
        return $this->hideHydraOperation;
×
687
    }
688

689
    public function withHideHydraOperation(bool $hideHydraOperation): static
690
    {
691
        $self = clone $this;
×
692
        $self->hideHydraOperation = $hideHydraOperation;
×
693

694
        return $self;
×
695
    }
696

697
    public function getJsonStream(): ?bool
698
    {
699
        return $this->jsonStream;
×
700
    }
701

702
    public function withJsonStream(bool $jsonStream): static
703
    {
704
        $self = clone $this;
×
705
        $self->jsonStream = $jsonStream;
×
706

707
        return $self;
×
708
    }
709
}
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

© 2025 Coveralls, Inc