Passed
Push — rebuild-optimizer ( 6a2db5 )
by Arnaud
05:42
created

AssetsMinify::processFile()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 5
rs 10
1
<?php
2
/*
3
 * Copyright (c) Arnaud Ligny <[email protected]>
4
 *
5
 * For the full copyright and license information, please view the LICENSE
6
 * file that was distributed with this source code.
7
 */
8
9
namespace Cecil\Step;
10
11
use voku\helper\HtmlMin;
12
13
/**
14
 * HTML files Optimization.
15
 */
16
class AssetsMinify extends AbstractStaticProcess
17
{
18
    /**
19
     * {@inheritdoc}
20
     */
21
    public function init($options)
22
    {
23
        parent::init($options);
24
    }
25
26
    /**
27
     * {@inheritdoc}
28
     */
29
    public function setProcessor()
30
    {
31
        $this->type = 'html';
32
        $this->processor = new HtmlMin();
33
    }
34
35
    /**
36
     * {@inheritdoc}
37
     */
38
    public function processFile(\Symfony\Component\Finder\SplFileInfo $file)
39
    {
40
        $html = file_get_contents($file->getPathname());
41
        $htmlCompressed = $this->processor->minify($html);
42
        \Cecil\Util::getFS()->dumpFile($file->getPathname(), $htmlCompressed);
43
    }
44
}
45