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

api-platform / core / 10638675968

30 Aug 2024 08:19PM UTC coverage: 74.332% (+10.4%) from 63.901%
10638675968

push

github

web-flow
chore: deprecations (#6563)

* chore: deprecations

* chore: deprecations

5 of 5 new or added lines in 3 files covered. (100.0%)

100 existing lines in 9 files now uncovered.

3226 of 4340 relevant lines covered (74.33%)

77.04 hits per line

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

0.0
/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\Doctrine\Orm\State\Options;
17
use ApiPlatform\Metadata\CollectionOperationInterface;
18
use ApiPlatform\Metadata\HttpOperation;
19
use ApiPlatform\Metadata\Operation;
20
use ApiPlatform\ParameterValidator\ParameterValidator;
21
use ApiPlatform\State\ProviderInterface;
22
use ApiPlatform\State\Util\RequestParser;
23

24
/**
25
 * @deprecated the query parameter validator is deprecated
26
 */
27
final class QueryParameterValidateProvider implements ProviderInterface
28
{
29
    public function __construct(private readonly ?ProviderInterface $decorated, private readonly ParameterValidator $parameterValidator)
30
    {
UNCOV
31
    }
×
32

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

UNCOV
44
        if (!($operation->getExtraProperties()['use_legacy_parameter_validator'] ?? true)) {
×
UNCOV
45
            return $this->decorated?->provide($operation, $uriVariables, $context);
×
46
        }
47

UNCOV
48
        if (!($operation->getQueryParameterValidationEnabled() ?? true) || !$operation instanceof CollectionOperationInterface) {
×
UNCOV
49
            return $this->decorated?->provide($operation, $uriVariables, $context);
×
50
        }
51

52
        $queryString = RequestParser::getQueryString($request);
×
53
        $queryParameters = $queryString ? RequestParser::parseRequestParams($queryString) : [];
×
54
        $class = $operation->getClass();
×
55
        if (($options = $operation->getStateOptions()) && $options instanceof Options && $options->getEntityClass()) {
×
56
            $class = $options->getEntityClass();
×
57
        }
58

59
        $this->parameterValidator->validateFilters($class, $operation->getFilters() ?? [], $queryParameters);
×
60

61
        return $this->decorated?->provide($operation, $uriVariables, $context);
×
62
    }
63
}
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