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

api-platform / core / 19337755357

13 Nov 2025 04:03PM UTC coverage: 0.0%. Remained the same
19337755357

push

github

soyuka
Merge 4.2

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

61 existing lines in 11 files now uncovered.

0 of 56962 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/Metadata/Operation/Factory/OperationMetadataFactory.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\Metadata\Operation\Factory;
15

16
use ApiPlatform\Metadata\Operation;
17
use ApiPlatform\Metadata\Resource\Factory\ResourceMetadataCollectionFactoryInterface;
18
use ApiPlatform\Metadata\Resource\Factory\ResourceNameCollectionFactoryInterface;
19

20
final class OperationMetadataFactory implements OperationMetadataFactoryInterface
21
{
22
    private array $localCache = [];
23

24
    public function __construct(private readonly ResourceNameCollectionFactoryInterface $resourceNameCollectionFactory, private readonly ResourceMetadataCollectionFactoryInterface $resourceMetadataCollectionFactory)
25
    {
UNCOV
26
    }
×
27

28
    public function create(string $uriTemplate, array $context = []): ?Operation
29
    {
30
        if (isset($this->localCache[$uriTemplate])) {
×
31
            return $this->localCache[$uriTemplate];
×
32
        }
33

UNCOV
34
        foreach ($this->resourceNameCollectionFactory->create() as $resourceClass) {
×
UNCOV
35
            foreach ($this->resourceMetadataCollectionFactory->create($resourceClass) as $resource) {
×
UNCOV
36
                foreach ($resource->getOperations() as $operation) {
×
UNCOV
37
                    if ($operation->getUriTemplate() === $uriTemplate || $operation->getName() === $uriTemplate) {
×
38
                        return $this->localCache[$uriTemplate] = $operation;
×
39
                    }
40
                }
41
            }
42
        }
43

UNCOV
44
        return null;
×
45
    }
46
}
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