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

tito10047 / progressive-image-bundle / 20693585928

04 Jan 2026 01:24PM UTC coverage: 89.796%. Remained the same
20693585928

push

github

tito10047
cs fixer

704 of 784 relevant lines covered (89.8%)

252.6 hits per line

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

83.33
/src/Decorators/LiipImagineDecorator.php
1
<?php
2

3
/*
4
 * This file is part of the Progressive Image Bundle.
5
 *
6
 * (c) Jozef Môstka <https://github.com/tito10047/progressive-image-bundle>
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
namespace Tito10047\ProgressiveImageBundle\Decorators;
13

14
use Liip\ImagineBundle\Imagine\Cache\CacheManager;
15
use Liip\ImagineBundle\Imagine\Filter\FilterConfiguration;
16
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
17

18
final class LiipImagineDecorator implements PathDecoratorInterface
19
{
20
    public function __construct(
21
        private readonly CacheManager $cache,
22
        private readonly FilterConfiguration $configuration,
23
    ) {
24
    }
56✔
25

26
    /**
27
     * @param array<string, mixed> $context
28
     */
29
    public function decorate(string $path, array $context = []): string
30
    {
31
        $filter = $context['filter'] ?? null;
56✔
32
        if (!$filter) {
56✔
33
            return $path;
14✔
34
        }
35
        if ($this->cache->isStored($path, $filter)) {
42✔
36
            return $this->cache->resolve($path, $filter);
×
37
        }
38
        $config = $context['config'] ?? [];
42✔
39
        $resolver = $context['resolver'] ?? null;
42✔
40
        $referenceType = $context['referenceType'] ?? UrlGeneratorInterface::ABSOLUTE_URL;
42✔
41

42
        return $this->cache->getBrowserPath($path, $filter, $config, $resolver, $referenceType);
42✔
43
    }
44

45
    /**
46
     * @param array<string, mixed> $context
47
     *
48
     * @return array{
49
     *     width: int,
50
     *     height: int
51
     * }|null
52
     */
53
    public function getSize(string $path, array $context = []): ?array
54
    {
55
        $filter = $context['filter'] ?? null;
28✔
56
        if (!$filter) {
28✔
57
            return null;
×
58
        }
59
        $config = $this->configuration->get($filter);
28✔
60
        $size = $config['filters']['thumbnail']['size'] ?? null;
28✔
61
        if (!$size) {
28✔
62
            return null;
×
63
        }
64

65
        return ['width' => $size[0], 'height' => $size[1]];
28✔
66
    }
67
}
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