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

ColorChannel::Percent()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 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