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

api-platform / core / 10527217182

23 Aug 2024 02:11PM UTC coverage: 7.707% (+4.0%) from 3.736%
10527217182

push

github

web-flow
fix(laravel): entrypoint serialization (#6541)

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

1 existing line in 1 file now uncovered.

12490 of 162060 relevant lines covered (7.71%)

22.98 hits per line

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

0.0
/src/Documentation/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\Documentation\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
 * @deprecated use ApiPlatform\Symfony\EntrypointAction instead
29
 *
30
 * @author Kévin Dunglas <dunglas@gmail.com>
31
 */
32
final class EntrypointAction
33
{
34
    private static ResourceNameCollection $resourceNameCollection;
35

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

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

63
        return $this->processor->process($body, $operation, [], $context);
×
64
    }
65

66
    public static function provide(): Entrypoint
67
    {
NEW
68
        return new Entrypoint(self::$resourceNameCollection);
×
69
    }
70
}
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