|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* @package Application Utils |
|
4
|
|
|
* @subpackage RGBAColor |
|
5
|
|
|
* @see \AppUtils\RGBAColor\ColorChannel\HueChannel |
|
6
|
|
|
*/ |
|
7
|
|
|
|
|
8
|
|
|
declare(strict_types=1); |
|
9
|
|
|
|
|
10
|
|
|
namespace AppUtils\RGBAColor\ColorChannel; |
|
11
|
|
|
|
|
12
|
|
|
use AppUtils\RGBAColor\ColorChannel; |
|
13
|
|
|
use AppUtils\RGBAColor\UnitsConverter; |
|
14
|
|
|
use testsuites\Traits\RenderableTests; |
|
|
|
|
|
|
15
|
|
|
|
|
16
|
|
|
/** |
|
17
|
|
|
* Color channel with values from 0 to 360, |
|
18
|
|
|
* intended to represent the hue of a color. |
|
19
|
|
|
* |
|
20
|
|
|
* Native value: {@see self::getValue()}. |
|
21
|
|
|
* |
|
22
|
|
|
* @package Application Utils |
|
23
|
|
|
* @subpackage RGBAColor |
|
24
|
|
|
* @author Sebastian Mordziol <[email protected]> |
|
25
|
|
|
*/ |
|
26
|
|
|
class HueChannel extends ColorChannel |
|
27
|
|
|
{ |
|
28
|
|
|
public const VALUE_MIN = 0.0; |
|
29
|
|
|
public const VALUE_MAX = 360.0; |
|
30
|
|
|
|
|
31
|
|
|
/** |
|
32
|
|
|
* @var float |
|
33
|
|
|
*/ |
|
34
|
|
|
private float $value; |
|
35
|
|
|
|
|
36
|
|
|
/** |
|
37
|
|
|
* @param int|float $value |
|
38
|
|
|
*/ |
|
39
|
|
|
public function __construct($value) |
|
40
|
|
|
{ |
|
41
|
|
|
$value = (float)$value; |
|
42
|
|
|
|
|
43
|
|
|
if($value < self::VALUE_MIN) { $value = self::VALUE_MIN; } |
|
44
|
|
|
if($value > self::VALUE_MAX) { $value = self::VALUE_MAX; } |
|
45
|
|
|
|
|
46
|
|
|
$this->value = $value; |
|
47
|
|
|
} |
|
48
|
|
|
|
|
49
|
|
|
/** |
|
50
|
|
|
* Retrieves the float value with full precision. |
|
51
|
|
|
* @return float 0 to 360 |
|
52
|
|
|
* @see self::getValueRounded() |
|
53
|
|
|
*/ |
|
54
|
|
|
public function getValue() : float |
|
55
|
|
|
{ |
|
56
|
|
|
return $this->value; |
|
57
|
|
|
} |
|
58
|
|
|
|
|
59
|
|
|
/** |
|
60
|
|
|
* Retrieves the value, rounded and converted to an integer. |
|
61
|
|
|
* @return int |
|
62
|
|
|
*/ |
|
63
|
|
|
public function getValueRounded() : int |
|
64
|
|
|
{ |
|
65
|
|
|
return (int)round($this->getValue()); |
|
66
|
|
|
} |
|
67
|
|
|
|
|
68
|
|
|
public function get8Bit() : int |
|
69
|
|
|
{ |
|
70
|
|
|
return UnitsConverter::hue2IntEightBit($this->value); |
|
71
|
|
|
} |
|
72
|
|
|
|
|
73
|
|
|
public function get7Bit() : int |
|
74
|
|
|
{ |
|
75
|
|
|
return UnitsConverter::hue2IntSevenBit($this->value); |
|
76
|
|
|
} |
|
77
|
|
|
|
|
78
|
|
|
public function getAlpha() : float |
|
79
|
|
|
{ |
|
80
|
|
|
return UnitsConverter::hue2Alpha($this->value); |
|
81
|
|
|
} |
|
82
|
|
|
|
|
83
|
|
|
public function getPercent() : float |
|
84
|
|
|
{ |
|
85
|
|
|
return UnitsConverter::hue2Percent($this->value); |
|
86
|
|
|
} |
|
87
|
|
|
|
|
88
|
|
|
public function invert() : HueChannel |
|
89
|
|
|
{ |
|
90
|
|
|
return ColorChannel::hue(360-$this->value); |
|
91
|
|
|
} |
|
92
|
|
|
} |
|
93
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths