Passed
Push — master ( 689ec5...45f08c )
by Sebastian
05:26
created

ColorChannel   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
eloc 5
c 1
b 0
f 0
dl 0
loc 33
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A Percent() 0 3 1
A CSSOpacity() 0 3 1
A EightBit() 0 3 1
A SevenBit() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace AppUtils\RGBAColor;
6
7
use AppUtils\RGBAColor\ColorChannel\CSSOpacityChannel;
8
use AppUtils\RGBAColor\ColorChannel\EightBitChannel;
9
use AppUtils\RGBAColor\ColorChannel\PercentChannel;
10
use AppUtils\RGBAColor\ColorChannel\SevenBitChannel;
11
12
abstract class ColorChannel
13
{
14
    abstract public function get8Bit() : int;
15
16
    abstract public function get7Bit() : int;
17
18
    abstract public function getFloat() : float;
19
20
    abstract public function getPercent() : float;
21
22
    /**
23
     * @return ColorChannel
24
     */
25
    abstract public function invert();
26
27
    public static function EightBit(int $value) : EightBitChannel
28
    {
29
        return new EightBitChannel($value);
30
    }
31
32
    public static function SevenBit(int $value) : SevenBitChannel
33
    {
34
        return new SevenBitChannel($value);
35
    }
36
37
    public static function Percent(float $percent) : PercentChannel
38
    {
39
        return new PercentChannel($percent);
40
    }
41
42
    public static function CSSOpacity(float $opacity) : CSSOpacityChannel
43
    {
44
        return new CSSOpacityChannel($opacity);
45
    }
46
}
47