Options::options()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 16
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 10
CRAP Score 2.003

Importance

Changes 0
Metric Value
dl 0
loc 16
ccs 10
cts 11
cp 0.9091
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 11
nc 2
nop 0
crap 2.003
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