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

api-platform / core / 9710836697

28 Jun 2024 09:35AM UTC coverage: 63.285% (+1.2%) from 62.122%
9710836697

push

github

soyuka
docs: changelog v3.3.7

11104 of 17546 relevant lines covered (63.29%)

52.26 hits per line

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

73.25
/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|\Stringable|null             $security                https://api-platform.com/docs/core/security
26
     * @param string|\Stringable|null             $securityPostDenormalize https://api-platform.com/docs/core/security/#executing-access-control-rules-after-denormalization
27
     * @param mixed|null                          $mercure
28
     * @param mixed|null                          $messenger
29
     * @param mixed|null                          $input
30
     * @param mixed|null                          $output
31
     * @param mixed|null                          $provider
32
     * @param mixed|null                          $processor
33
     * @param Parameters|array<string, Parameter> $parameters
34
     */
35
    public function __construct(
36
        protected ?string $shortName = null,
37
        protected ?string $class = null,
38
        protected ?string $description = null,
39
        protected ?int $urlGenerationStrategy = null,
40
        protected ?string $deprecationReason = null,
41
        protected ?array $normalizationContext = null,
42
        protected ?array $denormalizationContext = null,
43
        protected ?bool $collectDenormalizationErrors = null,
44
        protected ?array $validationContext = null,
45
        protected ?array $filters = null,
46
        protected ?bool $elasticsearch = null,
47
        protected $mercure = null,
48
        protected $messenger = null,
49
        protected $input = null,
50
        protected $output = null,
51
        protected ?array $order = null,
52
        protected ?bool $fetchPartial = null,
53
        protected ?bool $forceEager = null,
54
        protected ?bool $paginationEnabled = null,
55
        protected ?string $paginationType = null,
56
        protected ?int $paginationItemsPerPage = null,
57
        protected ?int $paginationMaximumItemsPerPage = null,
58
        protected ?bool $paginationPartial = null,
59
        protected ?bool $paginationClientEnabled = null,
60
        protected ?bool $paginationClientItemsPerPage = null,
61
        protected ?bool $paginationClientPartial = null,
62
        protected ?bool $paginationFetchJoinCollection = null,
63
        protected ?bool $paginationUseOutputWalkers = null,
64
        protected string|\Stringable|null $security = null,
65
        protected ?string $securityMessage = null,
66
        protected string|\Stringable|null $securityPostDenormalize = null,
67
        protected ?string $securityPostDenormalizeMessage = null,
68
        protected string|\Stringable|null $securityPostValidation = null,
69
        protected ?string $securityPostValidationMessage = null,
70
        protected $provider = null,
71
        protected $processor = null,
72
        protected ?OptionsInterface $stateOptions = null,
73
        /**
74
         * @experimental
75
         */
76
        protected array|Parameters|null $parameters = [],
77
        protected array $extraProperties = []
78
    ) {
79
    }
1,115✔
80

81
    public function getShortName(): ?string
82
    {
83
        return $this->shortName;
512✔
84
    }
85

86
    public function withShortName(string $shortName): static
87
    {
88
        $self = clone $this;
274✔
89
        $self->shortName = $shortName;
274✔
90

91
        return $self;
274✔
92
    }
93

94
    public function getClass(): ?string
95
    {
96
        return $this->class;
387✔
97
    }
98

99
    public function withClass(string $class): static
100
    {
101
        $self = clone $this;
208✔
102
        $self->class = $class;
208✔
103

104
        return $self;
208✔
105
    }
106

107
    public function getDescription(): ?string
108
    {
109
        return $this->description;
249✔
110
    }
111

112
    public function withDescription(?string $description = null): static
113
    {
114
        $self = clone $this;
28✔
115
        $self->description = $description;
28✔
116

117
        return $self;
28✔
118
    }
119

120
    public function getUrlGenerationStrategy(): ?int
121
    {
122
        return $this->urlGenerationStrategy;
304✔
123
    }
124

125
    public function withUrlGenerationStrategy(int $urlGenerationStrategy): static
126
    {
127
        $self = clone $this;
4✔
128
        $self->urlGenerationStrategy = $urlGenerationStrategy;
4✔
129

130
        return $self;
4✔
131
    }
132

133
    public function getDeprecationReason(): ?string
134
    {
135
        return $this->deprecationReason;
249✔
136
    }
137

138
    public function withDeprecationReason($deprecationReason): static
139
    {
140
        $self = clone $this;
4✔
141
        $self->deprecationReason = $deprecationReason;
4✔
142

143
        return $self;
4✔
144
    }
145

146
    public function getNormalizationContext(): ?array
147
    {
148
        return $this->normalizationContext;
423✔
149
    }
150

151
    public function withNormalizationContext(array $normalizationContext): static
152
    {
153
        $self = clone $this;
97✔
154
        $self->normalizationContext = $normalizationContext;
97✔
155

156
        return $self;
97✔
157
    }
158

159
    public function getDenormalizationContext(): ?array
160
    {
161
        return $this->denormalizationContext;
300✔
162
    }
163

164
    public function withDenormalizationContext(array $denormalizationContext): static
165
    {
166
        $self = clone $this;
4✔
167
        $self->denormalizationContext = $denormalizationContext;
4✔
168

169
        return $self;
4✔
170
    }
171

172
    public function getCollectDenormalizationErrors(): ?bool
173
    {
174
        return $this->collectDenormalizationErrors;
267✔
175
    }
176

177
    public function withCollectDenormalizationErrors(?bool $collectDenormalizationErrors = null): static
178
    {
179
        $self = clone $this;
4✔
180
        $self->collectDenormalizationErrors = $collectDenormalizationErrors;
4✔
181

182
        return $self;
4✔
183
    }
184

185
    public function getValidationContext(): ?array
186
    {
187
        return $this->validationContext;
273✔
188
    }
189

190
    public function withValidationContext(array $validationContext): static
191
    {
192
        $self = clone $this;
×
193
        $self->validationContext = $validationContext;
×
194

195
        return $self;
×
196
    }
197

198
    /**
199
     * @return string[]|null
200
     */
201
    public function getFilters(): ?array
202
    {
203
        return $this->filters;
307✔
204
    }
205

206
    public function withFilters(array $filters): static
207
    {
208
        $self = clone $this;
38✔
209
        $self->filters = $filters;
38✔
210

211
        return $self;
38✔
212
    }
213

214
    /**
215
     * @deprecated this will be removed in v4
216
     */
217
    public function getElasticsearch(): ?bool
218
    {
219
        return $this->elasticsearch;
26✔
220
    }
221

222
    /**
223
     * @deprecated this will be removed in v4
224
     */
225
    public function withElasticsearch(bool $elasticsearch): static
226
    {
227
        $self = clone $this;
×
228
        $self->elasticsearch = $elasticsearch;
×
229

230
        return $self;
×
231
    }
232

233
    /**
234
     * @return array|bool|mixed|null
235
     */
236
    public function getMercure()
237
    {
238
        return $this->mercure;
279✔
239
    }
240

241
    public function withMercure($mercure): static
242
    {
243
        $self = clone $this;
16✔
244
        $self->mercure = $mercure;
16✔
245

246
        return $self;
16✔
247
    }
248

249
    public function getMessenger()
250
    {
251
        return $this->messenger;
26✔
252
    }
253

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

259
        return $self;
×
260
    }
261

262
    public function getInput()
263
    {
264
        return $this->input;
307✔
265
    }
266

267
    public function withInput($input): static
268
    {
269
        $self = clone $this;
78✔
270
        $self->input = $input;
78✔
271

272
        return $self;
78✔
273
    }
274

275
    public function getOutput()
276
    {
277
        return $this->output;
407✔
278
    }
279

280
    public function withOutput($output): static
281
    {
282
        $self = clone $this;
26✔
283
        $self->output = $output;
26✔
284

285
        return $self;
26✔
286
    }
287

288
    public function getOrder(): ?array
289
    {
290
        return $this->order;
78✔
291
    }
292

293
    public function withOrder(array $order): static
294
    {
295
        $self = clone $this;
4✔
296
        $self->order = $order;
4✔
297

298
        return $self;
4✔
299
    }
300

301
    public function getFetchPartial(): ?bool
302
    {
303
        return $this->fetchPartial;
102✔
304
    }
305

306
    public function withFetchPartial(bool $fetchPartial): static
307
    {
308
        $self = clone $this;
×
309
        $self->fetchPartial = $fetchPartial;
×
310

311
        return $self;
×
312
    }
313

314
    public function getForceEager(): ?bool
315
    {
316
        return $this->forceEager;
102✔
317
    }
318

319
    public function withForceEager(bool $forceEager): static
320
    {
321
        $self = clone $this;
4✔
322
        $self->forceEager = $forceEager;
4✔
323

324
        return $self;
4✔
325
    }
326

327
    public function getPaginationEnabled(): ?bool
328
    {
329
        return $this->paginationEnabled;
101✔
330
    }
331

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

337
        return $self;
×
338
    }
339

340
    public function getPaginationType(): ?string
341
    {
342
        return $this->paginationType;
26✔
343
    }
344

345
    public function withPaginationType(string $paginationType): static
346
    {
347
        $self = clone $this;
×
348
        $self->paginationType = $paginationType;
×
349

350
        return $self;
×
351
    }
352

353
    public function getPaginationItemsPerPage(): ?int
354
    {
355
        return $this->paginationItemsPerPage;
101✔
356
    }
357

358
    public function withPaginationItemsPerPage(int $paginationItemsPerPage): static
359
    {
360
        $self = clone $this;
14✔
361
        $self->paginationItemsPerPage = $paginationItemsPerPage;
14✔
362

363
        return $self;
14✔
364
    }
365

366
    public function getPaginationMaximumItemsPerPage(): ?int
367
    {
368
        return $this->paginationMaximumItemsPerPage;
101✔
369
    }
370

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

376
        return $self;
×
377
    }
378

379
    public function getPaginationPartial(): ?bool
380
    {
381
        return $this->paginationPartial;
78✔
382
    }
383

384
    public function withPaginationPartial(bool $paginationPartial): static
385
    {
386
        $self = clone $this;
4✔
387
        $self->paginationPartial = $paginationPartial;
4✔
388

389
        return $self;
4✔
390
    }
391

392
    public function getPaginationClientEnabled(): ?bool
393
    {
394
        return $this->paginationClientEnabled;
101✔
395
    }
396

397
    public function withPaginationClientEnabled(bool $paginationClientEnabled): static
398
    {
399
        $self = clone $this;
14✔
400
        $self->paginationClientEnabled = $paginationClientEnabled;
14✔
401

402
        return $self;
14✔
403
    }
404

405
    public function getPaginationClientItemsPerPage(): ?bool
406
    {
407
        return $this->paginationClientItemsPerPage;
101✔
408
    }
409

410
    public function withPaginationClientItemsPerPage(bool $paginationClientItemsPerPage): static
411
    {
412
        $self = clone $this;
14✔
413
        $self->paginationClientItemsPerPage = $paginationClientItemsPerPage;
14✔
414

415
        return $self;
14✔
416
    }
417

418
    public function getPaginationClientPartial(): ?bool
419
    {
420
        return $this->paginationClientPartial;
78✔
421
    }
422

423
    public function withPaginationClientPartial(bool $paginationClientPartial): static
424
    {
425
        $self = clone $this;
14✔
426
        $self->paginationClientPartial = $paginationClientPartial;
14✔
427

428
        return $self;
14✔
429
    }
430

431
    public function getPaginationFetchJoinCollection(): ?bool
432
    {
433
        return $this->paginationFetchJoinCollection;
78✔
434
    }
435

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

441
        return $self;
×
442
    }
443

444
    public function getPaginationUseOutputWalkers(): ?bool
445
    {
446
        return $this->paginationUseOutputWalkers;
78✔
447
    }
448

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

454
        return $self;
×
455
    }
456

457
    public function getSecurity(): ?string
458
    {
459
        return $this->security instanceof \Stringable ? (string) $this->security : $this->security;
287✔
460
    }
461

462
    public function withSecurity($security): static
463
    {
464
        $self = clone $this;
4✔
465
        $self->security = $security;
4✔
466

467
        return $self;
4✔
468
    }
469

470
    public function getSecurityMessage(): ?string
471
    {
472
        return $this->securityMessage;
287✔
473
    }
474

475
    public function withSecurityMessage(string $securityMessage): static
476
    {
477
        $self = clone $this;
×
478
        $self->securityMessage = $securityMessage;
×
479

480
        return $self;
×
481
    }
482

483
    public function getSecurityPostDenormalize(): ?string
484
    {
485
        return $this->securityPostDenormalize instanceof \Stringable ? (string) $this->securityPostDenormalize : $this->securityPostDenormalize;
263✔
486
    }
487

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

493
        return $self;
×
494
    }
495

496
    public function getSecurityPostDenormalizeMessage(): ?string
497
    {
498
        return $this->securityPostDenormalizeMessage;
263✔
499
    }
500

501
    public function withSecurityPostDenormalizeMessage(string $securityPostDenormalizeMessage): static
502
    {
503
        $self = clone $this;
×
504
        $self->securityPostDenormalizeMessage = $securityPostDenormalizeMessage;
×
505

506
        return $self;
×
507
    }
508

509
    public function getSecurityPostValidation(): ?string
510
    {
511
        return $this->securityPostValidation instanceof \Stringable ? (string) $this->securityPostValidation : $this->securityPostValidation;
263✔
512
    }
513

514
    public function withSecurityPostValidation(string|\Stringable|null $securityPostValidation = null): static
515
    {
516
        $self = clone $this;
×
517
        $self->securityPostValidation = $securityPostValidation;
×
518

519
        return $self;
×
520
    }
521

522
    public function getSecurityPostValidationMessage(): ?string
523
    {
524
        return $this->securityPostValidationMessage;
263✔
525
    }
526

527
    public function withSecurityPostValidationMessage(?string $securityPostValidationMessage = null): static
528
    {
529
        $self = clone $this;
×
530
        $self->securityPostValidationMessage = $securityPostValidationMessage;
×
531

532
        return $self;
×
533
    }
534

535
    public function getProcessor(): callable|string|null
536
    {
537
        return $this->processor;
93✔
538
    }
539

540
    public function withProcessor(callable|string|null $processor): static
541
    {
542
        $self = clone $this;
32✔
543
        $self->processor = $processor;
32✔
544

545
        return $self;
32✔
546
    }
547

548
    public function getProvider(): callable|string|null
549
    {
550
        return $this->provider;
259✔
551
    }
552

553
    public function withProvider(callable|string|null $provider): static
554
    {
555
        $self = clone $this;
17✔
556
        $self->provider = $provider;
17✔
557

558
        return $self;
17✔
559
    }
560

561
    public function getStateOptions(): ?OptionsInterface
562
    {
563
        return $this->stateOptions;
287✔
564
    }
565

566
    public function withStateOptions(?OptionsInterface $stateOptions): static
567
    {
568
        $self = clone $this;
8✔
569
        $self->stateOptions = $stateOptions;
8✔
570

571
        return $self;
8✔
572
    }
573

574
    /**
575
     * @return array<string, Parameter>
576
     */
577
    public function getParameters(): array|Parameters|null
578
    {
579
        return $this->parameters;
283✔
580
    }
581

582
    public function withParameters(array|Parameters $parameters): static
583
    {
584
        $self = clone $this;
247✔
585
        $self->parameters = $parameters;
247✔
586

587
        return $self;
247✔
588
    }
589

590
    public function getExtraProperties(): ?array
591
    {
592
        return $this->extraProperties;
291✔
593
    }
594

595
    public function withExtraProperties(array $extraProperties = []): static
596
    {
597
        $self = clone $this;
26✔
598
        $self->extraProperties = $extraProperties;
26✔
599

600
        return $self;
26✔
601
    }
602
}
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