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

api-platform / core / 8100432467

29 Feb 2024 05:53PM UTC coverage: 56.922% (-7.0%) from 63.915%
8100432467

push

github

web-flow
fix: components split dependencies (#6186)

19 of 61 new or added lines in 2 files covered. (31.15%)

19 existing lines in 1 file now uncovered.

9510 of 16707 relevant lines covered (56.92%)

41.0 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
    ) {
UNCOV
42
    }
×
43

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

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

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

© 2025 Coveralls, Inc