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

api-platform / core / 10903050455

17 Sep 2024 12:29PM UTC coverage: 7.684% (+0.7%) from 6.96%
10903050455

push

github

web-flow
fix: swagger ui with route identifier (#6616)

2 of 6 new or added lines in 6 files covered. (33.33%)

9000 existing lines in 286 files now uncovered.

12668 of 164863 relevant lines covered (7.68%)

22.93 hits per line

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

67.8
/src/Metadata/Parameter.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\OpenApi;
17
use ApiPlatform\OpenApi\Model\Parameter as OpenApiParameter;
18
use ApiPlatform\State\ParameterNotFound;
19
use ApiPlatform\State\ParameterProviderInterface;
20

21
/**
22
 * @experimental
23
 */
24
abstract class Parameter
25
{
26
    /**
27
     * @param (array<string, mixed>&array{type?: string, default?: string})|null $schema
28
     * @param array<string, mixed>                                               $extraProperties
29
     * @param ParameterProviderInterface|callable|string|null                    $provider
30
     * @param FilterInterface|string|null                                        $filter
31
     * @param mixed                                                              $constraints     an array of Symfony constraints, or an array of Laravel rules
32
     */
33
    public function __construct(
34
        protected ?string $key = null,
35
        protected ?array $schema = null,
36
        protected OpenApiParameter|array|false|null $openApi = null,
37
        protected mixed $provider = null,
38
        protected mixed $filter = null,
39
        protected ?string $property = null,
40
        protected ?string $description = null,
41
        protected ?bool $required = null,
42
        protected ?int $priority = null,
43
        protected ?false $hydra = null,
44
        protected mixed $constraints = null,
45
        protected string|\Stringable|null $security = null,
46
        protected ?string $securityMessage = null,
47
        protected ?array $extraProperties = [],
48
        protected ?array $filterContext = null,
49
    ) {
UNCOV
50
    }
34✔
51

52
    public function getKey(): ?string
53
    {
UNCOV
54
        return $this->key;
1,136✔
55
    }
56

57
    /**
58
     * @return (array<string, mixed>&array{type?: string, default?: string})|null $schema
59
     */
60
    public function getSchema(): ?array
61
    {
UNCOV
62
        return $this->schema;
764✔
63
    }
64

65
    /**
66
     * @return OpenApi\Model\Parameter[]|OpenApi\Model\Parameter|bool|null
67
     */
68
    public function getOpenApi(): OpenApiParameter|array|bool|null
69
    {
UNCOV
70
        return $this->openApi;
49✔
71
    }
72

73
    public function getProvider(): mixed
74
    {
UNCOV
75
        return $this->provider;
638✔
76
    }
77

78
    public function getProperty(): ?string
79
    {
UNCOV
80
        return $this->property;
532✔
81
    }
82

83
    public function getFilter(): mixed
84
    {
UNCOV
85
        return $this->filter;
930✔
86
    }
87

88
    public function getDescription(): ?string
89
    {
UNCOV
90
        return $this->description;
39✔
91
    }
92

93
    public function getRequired(): ?bool
94
    {
UNCOV
95
        return $this->required;
449✔
96
    }
97

98
    public function getPriority(): ?int
99
    {
UNCOV
100
        return $this->priority;
3✔
101
    }
102

103
    public function getHydra(): ?bool
104
    {
UNCOV
105
        return $this->hydra;
298✔
106
    }
107

108
    public function getConstraints(): mixed
109
    {
UNCOV
110
        return $this->constraints;
726✔
111
    }
112

113
    public function getSecurity(): string|\Stringable|null
114
    {
UNCOV
115
        return $this->security;
695✔
116
    }
117

118
    public function getSecurityMessage(): ?string
119
    {
UNCOV
120
        return $this->securityMessage;
15✔
121
    }
122

123
    /**
124
     * The computed value of this parameter, located into extraProperties['_api_values'].
125
     *
126
     * @readonly
127
     */
128
    public function getValue(): mixed
129
    {
UNCOV
130
        return $this->extraProperties['_api_values'] ?? new ParameterNotFound();
789✔
131
    }
132

133
    /**
134
     * @return array<string, mixed>
135
     */
136
    public function getExtraProperties(): array
137
    {
UNCOV
138
        return $this->extraProperties;
638✔
139
    }
140

141
    public function getFilterContext(): ?array
142
    {
143
        return $this->filterContext;
×
144
    }
145

146
    public function withKey(string $key): static
147
    {
UNCOV
148
        $self = clone $this;
3✔
UNCOV
149
        $self->key = $key;
3✔
150

UNCOV
151
        return $self;
3✔
152
    }
153

154
    public function withPriority(int $priority): static
155
    {
UNCOV
156
        $self = clone $this;
3✔
UNCOV
157
        $self->priority = $priority;
3✔
158

UNCOV
159
        return $self;
3✔
160
    }
161

162
    /**
163
     * @param array{type?: string} $schema
164
     */
165
    public function withSchema(array $schema): static
166
    {
UNCOV
167
        $self = clone $this;
3✔
UNCOV
168
        $self->schema = $schema;
3✔
169

UNCOV
170
        return $self;
3✔
171
    }
172

173
    /**
174
     * @param OpenApi\Model\Parameter[]|OpenApi\Model\Parameter|bool $openApi
175
     */
176
    public function withOpenApi(OpenApiParameter|array|bool $openApi): static
177
    {
UNCOV
178
        $self = clone $this;
3✔
UNCOV
179
        $self->openApi = $openApi;
3✔
180

UNCOV
181
        return $self;
3✔
182
    }
183

184
    /**
185
     * @param ParameterProviderInterface|string $provider
186
     */
187
    public function withProvider(mixed $provider): static
188
    {
UNCOV
189
        $self = clone $this;
3✔
UNCOV
190
        $self->provider = $provider;
3✔
191

UNCOV
192
        return $self;
3✔
193
    }
194

195
    /**
196
     * @param FilterInterface|string $filter
197
     */
198
    public function withFilter(mixed $filter): static
199
    {
200
        $self = clone $this;
×
201
        $self->filter = $filter;
×
202

203
        return $self;
×
204
    }
205

206
    public function withProperty(string $property): static
207
    {
UNCOV
208
        $self = clone $this;
3✔
UNCOV
209
        $self->property = $property;
3✔
210

UNCOV
211
        return $self;
3✔
212
    }
213

214
    public function withDescription(string $description): static
215
    {
216
        $self = clone $this;
×
217
        $self->description = $description;
×
218

219
        return $self;
×
220
    }
221

222
    public function withRequired(bool $required): static
223
    {
224
        $self = clone $this;
×
225
        $self->required = $required;
×
226

227
        return $self;
×
228
    }
229

230
    public function withHydra(false $hydra): static
231
    {
232
        $self = clone $this;
×
233
        $self->hydra = $hydra;
×
234

235
        return $self;
×
236
    }
237

238
    public function withConstraints(mixed $constraints): static
239
    {
UNCOV
240
        $self = clone $this;
9✔
UNCOV
241
        $self->constraints = $constraints;
9✔
242

UNCOV
243
        return $self;
9✔
244
    }
245

246
    public function withSecurity(string|\Stringable|null $security): self
247
    {
248
        $self = clone $this;
×
249
        $self->security = $security;
×
250

251
        return $self;
×
252
    }
253

254
    public function withSecurityMessage(?string $securityMessage): self
255
    {
256
        $self = clone $this;
×
257
        $self->securityMessage = $securityMessage;
×
258

259
        return $self;
×
260
    }
261

262
    /**
263
     * @param array<string, mixed> $extraProperties
264
     */
265
    public function withExtraProperties(array $extraProperties): static
266
    {
UNCOV
267
        $self = clone $this;
638✔
UNCOV
268
        $self->extraProperties = $extraProperties;
638✔
269

UNCOV
270
        return $self;
638✔
271
    }
272
}
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