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

api-platform / core / 10739011304

06 Sep 2024 01:11PM UTC coverage: 7.159% (-0.5%) from 7.645%
10739011304

push

github

web-flow
 feat(laravel): eloquent filters (search, date, equals, or) (#6593)

* feat(laravel): Eloquent filters search date or

* feat(laravel): eloquent filters order range equals afterdate

* fix(laravel): order afterDate filters

* temp

* test(laravel): filter with eloquent

---------

Co-authored-by: Nathan <nathan@les-tilleuls.coop>

0 of 144 new or added lines in 16 files covered. (0.0%)

4792 existing lines in 155 files now uncovered.

11736 of 163930 relevant lines covered (7.16%)

22.8 hits per line

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

57.63
/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\State\ParameterNotFound;
18
use ApiPlatform\State\ParameterProviderInterface;
19
use Symfony\Component\Validator\Constraint;
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 Constraint|Constraint[]|null                                       $constraints
32
     */
33
    public function __construct(
34
        protected ?string $key = null,
35
        protected ?array $schema = null,
36
        protected OpenApi\Model\Parameter|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 Constraint|array|null $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,133✔
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;
759✔
63
    }
64

65
    public function getOpenApi(): OpenApi\Model\Parameter|bool|null
66
    {
UNCOV
67
        return $this->openApi;
39✔
68
    }
69

70
    public function getProvider(): mixed
71
    {
UNCOV
72
        return $this->provider;
635✔
73
    }
74

75
    public function getProperty(): ?string
76
    {
UNCOV
77
        return $this->property;
39✔
78
    }
79

80
    public function getFilter(): mixed
81
    {
UNCOV
82
        return $this->filter;
927✔
83
    }
84

85
    public function getDescription(): ?string
86
    {
UNCOV
87
        return $this->description;
36✔
88
    }
89

90
    public function getRequired(): ?bool
91
    {
UNCOV
92
        return $this->required;
446✔
93
    }
94

95
    public function getPriority(): ?int
96
    {
UNCOV
97
        return $this->priority;
3✔
98
    }
99

100
    public function getHydra(): ?bool
101
    {
UNCOV
102
        return $this->hydra;
298✔
103
    }
104

105
    /**
106
     * @return Constraint|Constraint[]|null
107
     */
108
    public function getConstraints(): Constraint|array|null
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();
786✔
131
    }
132

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

141
    public function getFilterContext(): ?array
142
    {
NEW
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
    {
167
        $self = clone $this;
×
168
        $self->schema = $schema;
×
169

170
        return $self;
×
171
    }
172

173
    public function withOpenApi(OpenApi\Model\Parameter $openApi): static
174
    {
175
        $self = clone $this;
×
176
        $self->openApi = $openApi;
×
177

178
        return $self;
×
179
    }
180

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

UNCOV
189
        return $self;
3✔
190
    }
191

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

200
        return $self;
×
201
    }
202

203
    public function withProperty(string $property): static
204
    {
UNCOV
205
        $self = clone $this;
3✔
UNCOV
206
        $self->property = $property;
3✔
207

UNCOV
208
        return $self;
3✔
209
    }
210

211
    public function withDescription(string $description): static
212
    {
213
        $self = clone $this;
×
214
        $self->description = $description;
×
215

216
        return $self;
×
217
    }
218

219
    public function withRequired(bool $required): static
220
    {
221
        $self = clone $this;
×
222
        $self->required = $required;
×
223

224
        return $self;
×
225
    }
226

227
    public function withHydra(false $hydra): static
228
    {
229
        $self = clone $this;
×
230
        $self->hydra = $hydra;
×
231

232
        return $self;
×
233
    }
234

235
    public function withConstraints(array|Constraint $constraints): static
236
    {
UNCOV
237
        $self = clone $this;
9✔
UNCOV
238
        $self->constraints = $constraints;
9✔
239

UNCOV
240
        return $self;
9✔
241
    }
242

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

248
        return $self;
×
249
    }
250

251
    public function withSecurityMessage(?string $securityMessage): self
252
    {
253
        $self = clone $this;
×
254
        $self->securityMessage = $securityMessage;
×
255

256
        return $self;
×
257
    }
258

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

UNCOV
267
        return $self;
635✔
268
    }
269
}
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