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

api-platform / core / 9809380648

05 Jul 2024 01:51PM UTC coverage: 63.374% (+0.08%) from 63.297%
9809380648

push

github

web-flow
fix(state): allow to skip parameter validator provider (#6452)

23 of 25 new or added lines in 9 files covered. (92.0%)

717 existing lines in 31 files now uncovered.

11143 of 17583 relevant lines covered (63.37%)

52.79 hits per line

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

100.0
/src/State/Util/ParameterParserTrait.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\State\Util;
15

16
use ApiPlatform\Metadata\HeaderParameterInterface;
17
use ApiPlatform\Metadata\Parameter;
18
use Symfony\Component\HttpFoundation\Request;
19

20
/**
21
 * @internal
22
 */
23
trait ParameterParserTrait
24
{
25
    /**
26
     * @param array<string, mixed> $values
27
     */
28
    private function getParameterFlattenKey(string $key, array $values): string
29
    {
30
        $parsedKey = explode('[:property]', $key);
83✔
31

32
        if (isset($parsedKey[0]) && isset($values[$parsedKey[0]])) {
83✔
33
            return $parsedKey[0];
75✔
34
        }
35

36
        return $key;
79✔
37
    }
38

39
    /**
40
     * @param array<string, mixed> $context
41
     *
42
     * @return array<string, mixed>
43
     */
44
    private function extractParameterValues(Parameter $parameter, ?Request $request, array $context): array
45
    {
46
        if ($request) {
83✔
47
            return ($parameter instanceof HeaderParameterInterface ? $request->attributes->get('_api_header_parameters') : $request->attributes->get('_api_query_parameters')) ?? [];
80✔
48
        }
49

50
        // GraphQl
UNCOV
51
        return $context['args'] ?? [];
3✔
52
    }
53
}
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