Passed
Pull Request — master (#5)
by
unknown
02:54
created

RawColorValue   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 3
dl 0
loc 24
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getCompiled() 0 8 2
A initializeFromOldFormat() 0 4 1
1
<?php
2
namespace LesserPhp\Compiler\Value;
3
4
/**
5
 * lesserphp
6
 * https://www.maswaba.de/lesserphp
7
 *
8
 * LESS CSS compiler, adapted from http://lesscss.org
9
 *
10
 * Copyright 2013, Leaf Corcoran <[email protected]>
11
 * Copyright 2016, Marcus Schwarz <[email protected]>
12
 * Copyright 2017, Stefan Pöhner <[email protected]>
13
 * Licensed under MIT or GPLv3, see LICENSE
14
 *
15
 * @package LesserPhp
16
 */
17
18
class RawColorValue extends AbstractValue
19
{
20
    private $value;
21
22
    /**
23
     * @inheritdoc
24
     */
25 13
    public function getCompiled()
26
    {
27 13
        if ($this->options['compressColors']) {
28 1
            return $this->compiler->compileValue($this->coerce->coerceColor(['raw_color', $this->value]));
29
        }
30
31 12
        return $this->value;
32
    }
33
34
    /**
35
     * @inheritdoc
36
     */
37 13
    public function initializeFromOldFormat(array $value)
38
    {
39 13
        $this->value = $value[1];
40
    }
41
}