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

Cecilapp / Cecil / 7135123744

07 Dec 2023 11:12PM UTC coverage: 83.092% (+0.6%) from 82.534%
7135123744

Pull #1676

github

web-flow
Merge b3b2dbc48 into 814daa587
Pull Request #1676: 8.x dev

182 of 222 new or added lines in 31 files covered. (81.98%)

15 existing lines in 5 files now uncovered.

2865 of 3448 relevant lines covered (83.09%)

0.83 hits per line

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

81.82
/src/Step/Optimize/Html.php
1
<?php
2

3
declare(strict_types=1);
4

5
/*
6
 * This file is part of Cecil.
7
 *
8
 * Copyright (c) Arnaud Ligny <arnaud@ligny.fr>
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code.
12
 */
13

14
namespace Cecil\Step\Optimize;
15

16
use Cecil\Util;
17
use voku\helper\HtmlMin;
18

19
/**
20
 * Optimize HTML files.
21
 */
22
class Html extends AbstractOptimize
23
{
24
    /**
25
     * {@inheritdoc}
26
     */
27
    public function getName(): string
28
    {
29
        return 'Optimizing HTML';
1✔
30
    }
31

32
    /**
33
     * {@inheritdoc}
34
     */
35
    public function init(array $options): void
36
    {
37
        $this->type = 'html';
1✔
38
        // https://github.com/voku/HtmlMin/issues/93
39
        if (version_compare(PHP_VERSION, '8.3.0', '>=')) {
1✔
NEW
40
            $this->builder->getLogger()->debug("{$this->getName()} is disabled for PHP 8.3");
×
41

NEW
42
            return;
×
43
        }
44
        parent::init($options);
1✔
45
    }
46

47
    /**
48
     * {@inheritdoc}
49
     */
50
    public function setProcessor(): void
51
    {
52
        $this->processor = new HtmlMin();
1✔
53
    }
54

55
    /**
56
     * {@inheritdoc}
57
     */
58
    public function processFile(\Symfony\Component\Finder\SplFileInfo $file): string
59
    {
60
        $html = Util\File::fileGetContents($file->getPathname());
1✔
61

62
        return $this->processor->minify($html);
1✔
63
    }
64

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

73
    /**
74
     * {@inheritdoc}
75
     */
76
    public function decode(string $content = null): ?string
77
    {
78
        return json_decode((string) $content);
1✔
79
    }
80
}
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