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.

RGBToHEXConverter::supportsFrom()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
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 RGBToHEXConverter implements ConverterInterface
13
{
14 131
    public function convert(Color $color): Color
15
    {
16
        /* @var RGB $color */
17 131
        Assert::isInstanceOf($color, RGB::class, sprintf('color should be an instance of [%s]', RGB::class));
18
19 130
        $red = dechex($color->getRed());
20 130
        $green = dechex($color->getGreen());
21 130
        $blue = dechex($color->getBlue());
22
23 130
        $red = str_pad($red, 2, '0', STR_PAD_LEFT);
24 130
        $green = str_pad($green, 2, '0', STR_PAD_LEFT);
25 130
        $blue = str_pad($blue, 2, '0', STR_PAD_LEFT);
26
27 130
        return new HEX($red, $green, $blue);
28
    }
29
30 924
    public static function supportsFrom(): string
31
    {
32 924
        return RGB::class;
33
    }
34
35 924
    public static function supportsTo(): string
36
    {
37 924
        return HEX::class;
38
    }
39
}
40