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

api-platform / core / 14954769666

11 May 2025 10:14AM UTC coverage: 0.0% (-8.5%) from 8.457%
14954769666

Pull #7135

github

web-flow
Merge bf21e0bc7 into 4dd0cdfc4
Pull Request #7135: fix(symfony,laravel): InvalidUriVariableException status code (e400)

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

11040 existing lines in 370 files now uncovered.

0 of 48303 relevant lines covered (0.0%)

0.0 hits per line

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

0.0
/src/Symfony/Action/EntrypointAction.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\Action;
15

16
use ApiPlatform\Documentation\Entrypoint;
17
use ApiPlatform\Metadata\Get;
18
use ApiPlatform\Metadata\Resource\Factory\ResourceNameCollectionFactoryInterface;
19
use ApiPlatform\Metadata\Resource\ResourceNameCollection;
20
use ApiPlatform\OpenApi\Serializer\LegacyOpenApiNormalizer;
21
use ApiPlatform\State\ProcessorInterface;
22
use ApiPlatform\State\ProviderInterface;
23
use Symfony\Component\HttpFoundation\Request;
24

25
/**
26
 * Generates the API entrypoint.
27
 *
28
 * @author Kévin Dunglas <dunglas@gmail.com>
29
 */
30
final class EntrypointAction
31
{
32
    private static ResourceNameCollection $resourceNameCollection;
33

34
    public function __construct(
35
        private readonly ResourceNameCollectionFactoryInterface $resourceNameCollectionFactory,
36
        private readonly ProviderInterface $provider,
37
        private readonly ProcessorInterface $processor,
38
        private readonly array $documentationFormats = [],
39
    ) {
UNCOV
40
    }
×
41

42
    public function __invoke(Request $request)
43
    {
UNCOV
44
        static::$resourceNameCollection = $this->resourceNameCollectionFactory->create();
×
UNCOV
45
        $context = [
×
UNCOV
46
            'request' => $request,
×
UNCOV
47
            'spec_version' => (string) $request->query->get(LegacyOpenApiNormalizer::SPEC_VERSION),
×
UNCOV
48
        ];
×
UNCOV
49
        $request->attributes->set('_api_platform_disable_listeners', true);
×
UNCOV
50
        $operation = new Get(
×
UNCOV
51
            outputFormats: $this->documentationFormats,
×
UNCOV
52
            read: true,
×
UNCOV
53
            serialize: true,
×
UNCOV
54
            class: Entrypoint::class,
×
UNCOV
55
            provider: [self::class, 'provide']
×
UNCOV
56
        );
×
UNCOV
57
        $request->attributes->set('_api_operation', $operation);
×
UNCOV
58
        $body = $this->provider->provide($operation, [], $context);
×
UNCOV
59
        $operation = $request->attributes->get('_api_operation');
×
60

UNCOV
61
        return $this->processor->process($body, $operation, [], $context);
×
62
    }
63

64
    public static function provide(): Entrypoint
65
    {
UNCOV
66
        return new Entrypoint(static::$resourceNameCollection);
×
67
    }
68
}
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