Passed
Push — master ( cfdd1e...2b821f )
by Marcus
02:49
created

Color::getValueA()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 4
cp 0
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 2
1
<?php
2
3
namespace LesserPhp;
4
5
/**
6
 * lesserphp
7
 * https://www.maswaba.de/lesserphp
8
 *
9
 * LESS CSS compiler, adapted from http://lesscss.org
10
 *
11
 * Copyright 2013, Leaf Corcoran <[email protected]>
12
 * Copyright 2016, Marcus Schwarz <[email protected]>
13
 * Licensed under MIT or GPLv3, see LICENSE
14
 * @package LesserPhp
15
 */
16
class Color
17
{
18
19
    const HSL = 'hsl';
20
    const RGB = 'rgb';
21
22
    private $valueA;
23
    private $valueB;
24
    private $valueC;
25
    private $type;
26
    private $alpha;
27
28
    /**
29
     * Color constructor.
30
     *
31
     * @param string $type
32
     * @param int $r
33
     * @param int $g
34
     * @param int $b
35
     * @param float|null $alpha
36
     */
37
    public function __construct($type, $r, $g, $b, $alpha = null)
38
    {
39
        $this->type = $type;
40
        $this->valueA = $r;
41
        $this->valueB = $g;
42
        $this->valueC = $b;
43
        $this->alpha = $alpha;
44
    }
45
46
    /**
47
     * @return float
48
     */
49
    public function getValueA()
50
    {
51
        return $this->valueA;
52
    }
53
54
    /**
55
     * @return float
56
     */
57
    public function getValueB()
58
    {
59
        return $this->valueB;
60
    }
61
62
    /**
63
     * @return float
64
     */
65
    public function getValueC()
66
    {
67
        return $this->valueC;
68
    }
69
70
    /**
71
     * @return string
72
     */
73
    public function getType()
74
    {
75
        return $this->type;
76
    }
77
78
    public function getRgb()
79
    {
80
        return [$this->valueA, $this->valueB, $this->valueC];
81
    }
82
83
    /**
84
     * @return null|float
85
     */
86
    public function getAlpha()
87
    {
88
        return $this->alpha;
89
    }
90
91
}
92