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

api-platform / core / 15133993414

20 May 2025 09:30AM UTC coverage: 26.313% (-1.2%) from 27.493%
15133993414

Pull #7161

github

web-flow
Merge e2c03d45f into 5459ba375
Pull Request #7161: fix(metadata): infer parameter string type from schema

0 of 2 new or added lines in 1 file covered. (0.0%)

11019 existing lines in 363 files now uncovered.

12898 of 49018 relevant lines covered (26.31%)

34.33 hits per line

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

55.0
/src/OpenApi/Model/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\OpenApi\Model;
15

16
final class Parameter
17
{
18
    use ExtensionTrait;
19

20
    public function __construct(private string $name, private string $in, private string $description = '', private bool $required = false, private bool $deprecated = false, private bool $allowEmptyValue = false, private array $schema = [], private ?string $style = null, private bool $explode = false, private bool $allowReserved = false, private $example = null, private ?\ArrayObject $examples = null, private ?\ArrayObject $content = null)
21
    {
UNCOV
22
        if (null === $style) {
242✔
UNCOV
23
            if ('query' === $in || 'cookie' === $in) {
242✔
UNCOV
24
                $this->style = 'form';
242✔
UNCOV
25
            } elseif ('path' === $in || 'header' === $in) {
21✔
UNCOV
26
                $this->style = 'simple';
21✔
27
            }
28
        }
29
    }
30

31
    public function getName(): string
32
    {
UNCOV
33
        return $this->name;
156✔
34
    }
35

36
    public function getIn(): string
37
    {
UNCOV
38
        return $this->in;
22✔
39
    }
40

41
    public function getDescription(): string
42
    {
UNCOV
43
        return $this->description;
156✔
44
    }
45

46
    public function getRequired(): bool
47
    {
UNCOV
48
        return $this->required;
156✔
49
    }
50

51
    public function getDeprecated(): bool
52
    {
UNCOV
53
        return $this->deprecated;
22✔
54
    }
55

56
    public function canAllowEmptyValue(): bool
57
    {
58
        return $this->allowEmptyValue;
×
59
    }
60

61
    public function getAllowEmptyValue(): bool
62
    {
UNCOV
63
        return $this->allowEmptyValue;
35✔
64
    }
65

66
    public function getSchema(): array
67
    {
UNCOV
68
        return $this->schema;
156✔
69
    }
70

71
    public function getStyle(): string
72
    {
UNCOV
73
        return $this->style;
22✔
74
    }
75

76
    public function canExplode(): bool
77
    {
78
        return $this->explode;
×
79
    }
80

81
    public function getExplode(): bool
82
    {
UNCOV
83
        return $this->explode;
22✔
84
    }
85

86
    public function canAllowReserved(): bool
87
    {
88
        return $this->allowReserved;
×
89
    }
90

91
    public function getAllowReserved(): bool
92
    {
UNCOV
93
        return $this->allowReserved;
22✔
94
    }
95

96
    public function getExample()
97
    {
UNCOV
98
        return $this->example;
22✔
99
    }
100

101
    public function getExamples(): ?\ArrayObject
102
    {
UNCOV
103
        return $this->examples;
22✔
104
    }
105

106
    public function getContent(): ?\ArrayObject
107
    {
UNCOV
108
        return $this->content;
22✔
109
    }
110

111
    public function withName(string $name): self
112
    {
113
        $clone = clone $this;
12✔
114
        $clone->name = $name;
12✔
115

116
        return $clone;
12✔
117
    }
118

119
    public function withIn(string $in): self
120
    {
121
        $clone = clone $this;
×
122
        $clone->in = $in;
×
123

124
        return $clone;
×
125
    }
126

127
    public function withDescription(string $description): self
128
    {
UNCOV
129
        $clone = clone $this;
13✔
UNCOV
130
        $clone->description = $description;
13✔
131

UNCOV
132
        return $clone;
13✔
133
    }
134

135
    public function withRequired(bool $required): self
136
    {
137
        $clone = clone $this;
12✔
138
        $clone->required = $required;
12✔
139

140
        return $clone;
12✔
141
    }
142

143
    public function withDeprecated(bool $deprecated): self
144
    {
145
        $clone = clone $this;
×
146
        $clone->deprecated = $deprecated;
×
147

148
        return $clone;
×
149
    }
150

151
    public function withAllowEmptyValue(bool $allowEmptyValue): self
152
    {
153
        $clone = clone $this;
12✔
154
        $clone->allowEmptyValue = $allowEmptyValue;
12✔
155

156
        return $clone;
12✔
157
    }
158

159
    public function withSchema(array $schema): self
160
    {
UNCOV
161
        $clone = clone $this;
15✔
UNCOV
162
        $clone->schema = $schema;
15✔
163

UNCOV
164
        return $clone;
15✔
165
    }
166

167
    public function withStyle(string $style): self
168
    {
169
        $clone = clone $this;
×
170
        $clone->style = $style;
×
171

172
        return $clone;
×
173
    }
174

175
    public function withExplode(bool $explode): self
176
    {
177
        $clone = clone $this;
×
178
        $clone->explode = $explode;
×
179

180
        return $clone;
×
181
    }
182

183
    public function withAllowReserved(bool $allowReserved): self
184
    {
185
        $clone = clone $this;
×
186
        $clone->allowReserved = $allowReserved;
×
187

188
        return $clone;
×
189
    }
190

191
    public function withExample($example): self
192
    {
193
        $clone = clone $this;
×
194
        $clone->example = $example;
×
195

196
        return $clone;
×
197
    }
198

199
    public function withExamples(\ArrayObject $examples): self
200
    {
201
        $clone = clone $this;
×
202
        $clone->examples = $examples;
×
203

204
        return $clone;
×
205
    }
206

207
    public function withContent(\ArrayObject $content): self
208
    {
209
        $clone = clone $this;
×
210
        $clone->content = $content;
×
211

212
        return $clone;
×
213
    }
214
}
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