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

api-platform / core / 20847864477

09 Jan 2026 09:47AM UTC coverage: 29.1% (+0.005%) from 29.095%
20847864477

Pull #7649

github

web-flow
Merge b342dd5db into d640d106b
Pull Request #7649: feat(validator): uuid/ulid parameter validation

0 of 4 new or added lines in 1 file covered. (0.0%)

15050 existing lines in 491 files now uncovered.

16996 of 58406 relevant lines covered (29.1%)

81.8 hits per line

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

42.11
/src/Metadata/Resource/Factory/PhpFileResourceMetadataCollectionFactory.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\Resource\Factory;
15

16
use ApiPlatform\Metadata\Extractor\ResourceExtractorInterface;
17
use ApiPlatform\Metadata\Operation;
18
use ApiPlatform\Metadata\Operations;
19
use ApiPlatform\Metadata\Resource\ResourceMetadataCollection;
20
use ApiPlatform\Metadata\Util\CamelCaseToSnakeCaseNameConverter;
21
use Psr\Log\LoggerInterface;
22
use Psr\Log\NullLogger;
23

24
final class PhpFileResourceMetadataCollectionFactory implements ResourceMetadataCollectionFactoryInterface
25
{
26
    use OperationDefaultsTrait;
27

28
    public function __construct(
29
        private readonly ResourceExtractorInterface $metadataExtractor,
30
        private readonly ?ResourceMetadataCollectionFactoryInterface $decorated = null,
31
        ?LoggerInterface $logger = null,
32
        array $defaults = [],
33
    ) {
UNCOV
34
        $this->logger = $logger ?? new NullLogger();
2,474✔
UNCOV
35
        $this->defaults = $defaults;
2,474✔
UNCOV
36
        $this->camelCaseToSnakeCaseNameConverter = new CamelCaseToSnakeCaseNameConverter();
2,474✔
37
    }
38

39
    /**
40
     * {@inheritdoc}
41
     */
42
    public function create(string $resourceClass): ResourceMetadataCollection
43
    {
UNCOV
44
        $resourceMetadataCollection = new ResourceMetadataCollection($resourceClass);
211✔
UNCOV
45
        if ($this->decorated) {
211✔
UNCOV
46
            $resourceMetadataCollection = $this->decorated->create($resourceClass);
211✔
47
        }
48

UNCOV
49
        foreach ($this->metadataExtractor->getResources() as $resource) {
211✔
50
            if ($resourceClass !== $resource->getClass()) {
×
51
                continue;
×
52
            }
53

54
            $shortName = (false !== $pos = strrpos($resourceClass, '\\')) ? substr($resourceClass, $pos + 1) : $resourceClass;
×
55
            $resource = $this->getResourceWithDefaults($resourceClass, $shortName, $resource);
×
56

57
            $operations = [];
×
58
            /** @var Operation $operation */
59
            foreach ($resource->getOperations() ?? new Operations() as $operation) {
×
60
                [$key, $operation] = $this->getOperationWithDefaults($resource, $operation);
×
61
                $operations[$key] = $operation;
×
62
            }
63

64
            if ($operations) {
×
65
                $resource = $resource->withOperations(new Operations($operations));
×
66
            }
67

68
            $resourceMetadataCollection[] = $resource;
×
69
        }
70

UNCOV
71
        return $resourceMetadataCollection;
211✔
72
    }
73
}
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