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

Cecilapp / Cecil / 18438267546

12 Oct 2025 03:01AM UTC coverage: 81.901%. Remained the same
18438267546

push

github

ArnaudLigny
refactor: better error/warning messages

5 of 40 new or added lines in 15 files covered. (12.5%)

3163 of 3862 relevant lines covered (81.9%)

0.82 hits per line

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

80.0
/src/Step/Optimize/Images.php
1
<?php
2

3
/**
4
 * This file is part of Cecil.
5
 *
6
 * (c) Arnaud Ligny <arnaud@ligny.fr>
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 Cecil\Step\Optimize;
15

16
use Cecil\Util\ImageOptimizer as Optimizer;
17

18
/**
19
 * Optimize images step.
20
 *
21
 * This step optimizes images in the build process by using the
22
 * `Optimizer` class to process image files.
23
 * It extends the `AbstractOptimize` class and implements the necessary
24
 * methods to handle image optimization.
25
 */
26
class Images extends AbstractOptimize
27
{
28
    /**
29
     * {@inheritdoc}
30
     */
31
    public function getName(): string
32
    {
33
        return 'Optimizing images';
1✔
34
    }
35

36
    /**
37
     * {@inheritdoc}
38
     */
39
    public function init(array $options): void
40
    {
41
        $this->type = 'images';
1✔
42
        parent::init($options);
1✔
43
    }
44

45
    /**
46
     * {@inheritdoc}
47
     */
48
    public function setProcessor(): void
49
    {
50
        $this->processor = Optimizer::create((int) $this->config->get('assets.images.quality'));
1✔
51
    }
52

53
    /**
54
     * {@inheritdoc}
55
     */
56
    public function processFile(\Symfony\Component\Finder\SplFileInfo $file): string
57
    {
58
        try {
59
            $this->processor->optimize($file->getPathname());
1✔
60
        } catch (\Exception $e) {
×
NEW
61
            $this->builder->getLogger()->error(\sprintf('Unable to optimize image "%s": "%s"', $file->getPathname(), $e->getMessage()));
×
62
        }
63

64
        return $file->getContents();
1✔
65
    }
66

67
    /**
68
     * {@inheritdoc}
69
     */
70
    public function encode(?string $content = null): ?string
71
    {
72
        return base64_encode((string) $content);
1✔
73
    }
74

75
    /**
76
     * {@inheritdoc}
77
     */
78
    public function decode(?string $content = null): ?string
79
    {
80
        return base64_decode((string) $content);
1✔
81
    }
82
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc