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

tempestphp / tempest-framework / 11292234118

11 Oct 2024 12:22PM UTC coverage: 82.134%. First build
11292234118

Pull #560

github

web-flow
Merge 8256daad0 into 571879663
Pull Request #560: chore: refactor view engine

429 of 471 new or added lines in 34 files covered. (91.08%)

6758 of 8228 relevant lines covered (82.13%)

38.48 hits per line

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

83.33
/src/Tempest/View/src/ViewCache.php
1
<?php
2

3
declare(strict_types=1);
4

5
namespace Tempest\View;
6

7
use Closure;
8
use Psr\Cache\CacheItemPoolInterface;
9
use Tempest\Cache\Cache;
10
use Tempest\Cache\CacheConfig;
11
use Tempest\Cache\IsCache;
12
use function Tempest\path;
13

14
final class ViewCache implements Cache
15
{
16
    use IsCache;
17

18
    public function __construct(private readonly CacheConfig $cacheConfig, private readonly ViewCachePool $cachePool = new ViewCachePool())
58✔
19
    {
20
    }
58✔
21

22
    public function getCachedViewPath(string $path, Closure $compiledView): string
52✔
23
    {
24
        $cacheKey = (string)crc32($path);
52✔
25

26
        $cacheItem = $this->cachePool->getItem($cacheKey);
52✔
27

28
        if ($this->cacheConfig->enabled === false || $cacheItem->isHit() === false) {
52✔
29
            $cacheItem = $this->put($cacheKey, $compiledView());
51✔
30
        }
31

32
        return path($this->cachePool->directory, $cacheItem->getKey() . '.php');
51✔
33
    }
34

35
    protected function getCachePool(): CacheItemPoolInterface
52✔
36
    {
37
        return $this->cachePool;
52✔
38
    }
39

NEW
40
    protected function isEnabled(): bool
×
41
    {
NEW
42
        return $this->cacheConfig->enabled;
×
43
    }
44
}
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