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.

HEXToRGBConverter   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 8
c 1
b 0
f 0
dl 0
loc 22
ccs 10
cts 10
cp 1
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A convert() 0 10 1
A supportsTo() 0 3 1
A supportsFrom() 0 3 1
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\HEX;
9
use Artack\Color\Color\RGB;
10
use Webmozart\Assert\Assert;
11
12
class HEXToRGBConverter implements ConverterInterface
13
{
14 131
    public function convert(Color $color): Color
15
    {
16
        /* @var HEX $color */
17 131
        Assert::isInstanceOf($color, HEX::class, sprintf('color should be an instance of [%s]', HEX::class));
18
19 130
        $red = hexdec($color->getRed());
20 130
        $green = hexdec($color->getGreen());
21 130
        $blue = hexdec($color->getBlue());
22
23 130
        return new RGB($red, $green, $blue);
0 ignored issues
show
Bug introduced by
It seems like $red can also be of type double; however, parameter $red of Artack\Color\Color\RGB::__construct() does only seem to accept integer, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

23
        return new RGB(/** @scrutinizer ignore-type */ $red, $green, $blue);
Loading history...
Bug introduced by
It seems like $green can also be of type double; however, parameter $green of Artack\Color\Color\RGB::__construct() does only seem to accept integer, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

23
        return new RGB($red, /** @scrutinizer ignore-type */ $green, $blue);
Loading history...
Bug introduced by
It seems like $blue can also be of type double; however, parameter $blue of Artack\Color\Color\RGB::__construct() does only seem to accept integer, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

23
        return new RGB($red, $green, /** @scrutinizer ignore-type */ $blue);
Loading history...
24
    }
25
26 924
    public static function supportsFrom(): string
27
    {
28 924
        return HEX::class;
29
    }
30
31 924
    public static function supportsTo(): string
32
    {
33 924
        return RGB::class;
34
    }
35
}
36