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

api-platform / core / 10618078048

29 Aug 2024 03:28PM UTC coverage: 7.687% (-0.003%) from 7.69%
10618078048

push

github

web-flow
fix(laravel): cache metadata, add trace on debug mode (#6555)

0 of 143 new or added lines in 8 files covered. (0.0%)

3 existing lines in 1 file now uncovered.

12488 of 162451 relevant lines covered (7.69%)

22.92 hits per line

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

0.0
/src/Laravel/Metadata/CachePropertyNameCollectionMetadataFactory.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\Laravel\Metadata;
15

16
use ApiPlatform\Metadata\Property\Factory\PropertyNameCollectionFactoryInterface;
17
use ApiPlatform\Metadata\Property\PropertyNameCollection;
18
use Illuminate\Support\Facades\Cache;
19

20
final readonly class CachePropertyNameCollectionMetadataFactory implements PropertyNameCollectionFactoryInterface
21
{
22
    public function __construct(
23
        private PropertyNameCollectionFactoryInterface $decorated,
24
        private string $cacheStore
25
    ) {
NEW
26
    }
×
27

28
    public function create(string $resourceClass, array $options = []): PropertyNameCollection
29
    {
NEW
30
        $key = hash('xxh3', serialize(['resource_class' => $resourceClass] + $options));
×
31

NEW
32
        return Cache::store($this->cacheStore)->rememberForever($key, function () use ($resourceClass, $options) {
×
NEW
33
            return $this->decorated->create($resourceClass, $options);
×
NEW
34
        });
×
35
    }
36
}
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