ScriptMinifier   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
c 1
b 0
f 0
dl 0
loc 22
ccs 5
cts 5
cp 1
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A minify() 0 9 1
1
<?php
2
3
namespace Staticka\Filters;
4
5
/**
6
 * Script Minifier
7
 *
8
 * @package Staticka
9
 * @author  Rougin Gutib <[email protected]>
10
 */
11
class ScriptMinifier extends InlineMinifier
12
{
13
    /**
14
     * @var string
15
     */
16
    protected $tagname = 'script';
17
18
    /**
19
     * Minifies the specified code.
20
     *
21
     * @param  string $code
22
     * @return string
23
     */
24 3
    protected function minify($code)
25
    {
26 3
        $code = (string) parent::minify($code);
27
28 3
        $code = preg_replace('/( )?=( )?/', '=', $code);
29
30 3
        $code = preg_replace('/( )?\(( )?/', '(', $code);
31
32 3
        return preg_replace('/( )?var ( )?/', '', $code);
33
    }
34
}
35