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

api-platform / core / 18118664137

30 Sep 2025 04:22AM UTC coverage: 0.0% (-22.0%) from 21.956%
18118664137

Pull #7397

github

web-flow
Merge d1e60d9d5 into 55fd65795
Pull Request #7397: fix(jsonschema/jsonld): make `@id` and `@type` properties required only in the JSON-LD schema for output

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

12143 existing lines in 402 files now uncovered.

0 of 53916 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/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

21
final class PhpFileResourceMetadataCollectionFactory implements ResourceMetadataCollectionFactoryInterface
22
{
23
    use OperationDefaultsTrait;
24

25
    public function __construct(
26
        private readonly ResourceExtractorInterface $metadataExtractor,
27
        private readonly ?ResourceMetadataCollectionFactoryInterface $decorated = null,
28
    ) {
UNCOV
29
    }
×
30

31
    /**
32
     * {@inheritdoc}
33
     */
34
    public function create(string $resourceClass): ResourceMetadataCollection
35
    {
UNCOV
36
        $resourceMetadataCollection = new ResourceMetadataCollection($resourceClass);
×
UNCOV
37
        if ($this->decorated) {
×
UNCOV
38
            $resourceMetadataCollection = $this->decorated->create($resourceClass);
×
39
        }
40

UNCOV
41
        foreach ($this->metadataExtractor->getResources() as $resource) {
×
42
            if ($resourceClass !== $resource->getClass()) {
×
43
                continue;
×
44
            }
45

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

49
            $operations = [];
×
50
            /** @var Operation $operation */
51
            foreach ($resource->getOperations() ?? new Operations() as $operation) {
×
52
                [$key, $operation] = $this->getOperationWithDefaults($resource, $operation);
×
53
                $operations[$key] = $operation;
×
54
            }
55

56
            if ($operations) {
×
57
                $resource = $resource->withOperations(new Operations($operations));
×
58
            }
59

60
            $resourceMetadataCollection[] = $resource;
×
61
        }
62

UNCOV
63
        return $resourceMetadataCollection;
×
64
    }
65
}
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