Options   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 90.91%

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 1
dl 0
loc 35
ccs 10
cts 11
cp 0.9091
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A options() 0 16 2
1
<?php
2
3
namespace ArjanSchouten\HtmlMinifier;
4
5
class Options
6
{
7
    const ALL = 'all';
8
    const EMPTY_ATTRIBUTES = 'remove-empty-attributes';
9
    const ATTRIBUTE_QUOTES = 'remove-attributequotes';
10
    const BOOLEAN_ATTRIBUTES = 'boolean-attributes';
11
    const OPTIONAL_ELEMENTS = 'optional-elements';
12
    const REMOVE_DEFAULTS = 'remove-defaults';
13
    const WHITESPACES = 'whitespaces';
14
    const COMMENTS = 'comments';
15
16
    private static $options;
17
18
    /**
19
     * Get all the options available for this minifier.
20
     *
21
     * @return array
22
     */
23 2
    public static function options()
0 ignored issues
show
Coding Style Best Practice introduced by
Please use __construct() instead of a PHP4-style constructor that is named after the class.
Loading history...
24
    {
25 2
        if (self::$options === null) {
26
            self::$options = [
27 1
                self::WHITESPACES        => new Option(self::WHITESPACES, 'Remove redundant whitespaces', true),
28 1
                self::COMMENTS           => new Option(self::COMMENTS, 'Remove comments', true),
29 1
                self::BOOLEAN_ATTRIBUTES => new Option(self::BOOLEAN_ATTRIBUTES, 'Collapse boolean attributes from checked="checked" to checked', true),
30 1
                self::ATTRIBUTE_QUOTES   => new Option(self::ATTRIBUTE_QUOTES, 'Remove quotes around html attributes', false),
31 1
                self::OPTIONAL_ELEMENTS  => new Option(self::OPTIONAL_ELEMENTS, 'Remove optional elements which can be implied by the browser', false),
32 1
                self::REMOVE_DEFAULTS    => new Option(self::REMOVE_DEFAULTS, 'Remove defaults such as from <script type=text/javascript>', false),
33 1
                self::EMPTY_ATTRIBUTES   => new Option(self::EMPTY_ATTRIBUTES, 'Remove empty attributes. HTML boolean attributes are skipped', false),
34
            ];
35
        }
36
37 2
        return self::$options;
38
    }
39
}
40