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

68publishers / image-storage / 22296382066

23 Feb 2026 07:14AM UTC coverage: 87.603% (-3.8%) from 91.356%
22296382066

Pull #61

github

web-flow
Merge 9d5a8b32a into 57d73edfb
Pull Request #61: Better Presets

148 of 227 new or added lines in 17 files covered. (65.2%)

4 existing lines in 1 file now uncovered.

1484 of 1694 relevant lines covered (87.6%)

0.88 hits per line

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

71.43
/src/Modifier/Codec/RuntimeCachedCodec.php
1
<?php
2

3
declare(strict_types=1);
4

5
namespace SixtyEightPublishers\ImageStorage\Modifier\Codec;
6

7
use JsonException;
8
use function json_encode;
9

10
final class RuntimeCachedCodec implements CodecInterface
11
{
12
    /**
13
     * @var array{
14
     *     modifiersToPath: array<string, string>,
15
     *     pathToModifiers: array<string, array<string, string|numeric|bool>>,
16
     *     expandModifiers: array<string, array<string, string|numeric|bool>>,
17
     * }
18
     */
19
    private array $cache = [
20
        'modifiersToPath' => [],
21
        'pathToModifiers' => [],
22
        'expandModifiers' => [],
23
    ];
24

25
    public function __construct(
1✔
26
        private readonly CodecInterface $codec,
27
    ) {}
1✔
28

29
    /**
30
     * @throws JsonException
31
     */
32
    public function modifiersToPath(string|array $value): string
33
    {
34
        $key = json_encode($value, JSON_THROW_ON_ERROR);
1✔
35

36
        return $this->cache['modifiersToPath'][$key] ??= $this->codec->modifiersToPath($value);
1✔
37
    }
38

39
    public function pathToModifiers(string $value): array
40
    {
41
        return $this->cache['pathToModifiers'][$value] ??= $this->codec->pathToModifiers($value);
1✔
42
    }
43

44
    /**
45
     * @throws JsonException
46
     */
47
    public function expandModifiers(array|string $value): array
48
    {
NEW
49
        $key = json_encode($value, JSON_THROW_ON_ERROR);
×
50

NEW
51
        return $this->cache['expandModifiers'][$key] ??= $this->codec->expandModifiers($value);
×
52
    }
53
}
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