GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Test Failed
Push — master ( 003f3e...5f1f5d )
by Patrick
02:17
created

src/Converter/HSVToRGBConverter.php (3 issues)

1
<?php
2
3
declare(strict_types=1);
4
5
namespace Artack\Color\Converter;
6
7
use Artack\Color\Color\Color;
8
use Artack\Color\Color\HSV;
9
use Artack\Color\Color\RGB;
10
use Webmozart\Assert\Assert;
11
12
class HSVToRGBConverter implements Convertible
13
{
14
    public function convert(Color $color): Color
15
    {
16
        /* @var HSV $color */
17
        Assert::isInstanceOf($color, HSV::class, sprintf('color should be an instance of [%s]', HSV::class));
18
19
        $h = $color->getHue();
20
        $s = $color->getSaturation() / 100;
21
        $v = $color->getValue() / 100;
22
23
        $hF = floor($h / 60);
24
        $f = $h / 60 - $hF;
25
26
        $p = $v * (1 - $s);
27
        $q = $v * (1 - $s * $f);
28
        $t = $v * (1 - $s * (1 - $f));
29
30
        switch ($hF) {
31
            case 0:
32
                $r = $v;
33
                $g = $t;
34
                $b = $p;
35
                break;
36
            case 1:
37
                $r = $q;
38
                $g = $v;
39
                $b = $p;
40
                break;
41
            case 2:
42
                $r = $p;
43
                $g = $v;
44
                $b = $t;
45
                break;
46
            case 3:
47
                $r = $p;
48
                $g = $q;
49
                $b = $v;
50
                break;
51
            case 4:
52
                $r = $t;
53
                $g = $p;
54
                $b = $v;
55
                break;
56
            case 5:
57
                $r = $v;
58
                $g = $p;
59
                $b = $q;
60
                break;
61
        }
62
63
        return new RGB((int) round($r * 255), (int) round($g * 255), (int) round($b * 255));
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $b does not seem to be defined for all execution paths leading up to this point.
Loading history...
Comprehensibility Best Practice introduced by
The variable $g does not seem to be defined for all execution paths leading up to this point.
Loading history...
Comprehensibility Best Practice introduced by
The variable $r does not seem to be defined for all execution paths leading up to this point.
Loading history...
64
    }
65
66
    public static function supportsFrom(): string
67
    {
68
        return HSV::class;
69
    }
70
71
    public static function supportsTo(): string
72
    {
73
        return RGB::class;
74
    }
75
}
76