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

api-platform / core / 7196499749

13 Dec 2023 02:17PM UTC coverage: 37.359% (+1.4%) from 36.003%
7196499749

push

github

web-flow
ci: conflict sebastian/comparator (#6032)

* ci: conflict sebastian/comparator

* for lowest

10295 of 27557 relevant lines covered (37.36%)

28.14 hits per line

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

93.33
/src/Symfony/Validator/State/QueryParameterValidateProvider.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\Symfony\Validator\State;
15

16
use ApiPlatform\Api\QueryParameterValidator\QueryParameterValidator;
17
use ApiPlatform\Doctrine\Orm\State\Options;
18
use ApiPlatform\Metadata\CollectionOperationInterface;
19
use ApiPlatform\Metadata\HttpOperation;
20
use ApiPlatform\Metadata\Operation;
21
use ApiPlatform\State\ProviderInterface;
22
use ApiPlatform\State\Util\RequestParser;
23

24
final class QueryParameterValidateProvider implements ProviderInterface
25
{
26
    public function __construct(private readonly ProviderInterface $decorated, private readonly QueryParameterValidator $queryParameterValidator)
27
    {
28
    }
89✔
29

30
    public function provide(Operation $operation, array $uriVariables = [], array $context = []): object|array|null
31
    {
32
        if (
33
            !$operation instanceof HttpOperation
89✔
34
            || !($request = $context['request'] ?? null)
89✔
35
            || !$request->isMethodSafe()
89✔
36
            || 'GET' !== $request->getMethod()
89✔
37
        ) {
38
            return $this->decorated->provide($operation, $uriVariables, $context);
9✔
39
        }
40

41
        if (!($operation->getQueryParameterValidationEnabled() ?? true) || !$operation instanceof CollectionOperationInterface) {
80✔
42
            return $this->decorated->provide($operation, $uriVariables, $context);
55✔
43
        }
44

45
        $queryString = RequestParser::getQueryString($request);
28✔
46
        $queryParameters = $queryString ? RequestParser::parseRequestParams($queryString) : [];
28✔
47
        $class = $operation->getClass();
28✔
48
        if (($options = $operation->getStateOptions()) && $options instanceof Options && $options->getEntityClass()) {
28✔
49
            $class = $options->getEntityClass();
×
50
        }
51

52
        $this->queryParameterValidator->validateFilters($class, $operation->getFilters() ?? [], $queryParameters);
28✔
53

54
        return $this->decorated->provide($operation, $uriVariables, $context);
28✔
55
    }
56
}
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

© 2026 Coveralls, Inc