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.
Completed
Push — master ( 8dbce3...a69053 )
by Patrick
02:15
created

RGBTransition::supports()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Artack\Color\Transition;
6
7
use Artack\Color\Color\Color;
8
use Artack\Color\Color\RGB;
9
use Webmozart\Assert\Assert;
10
11
class RGBTransition implements TransitionInterface
12
{
13
    public function interpolate(Color $startColor, Color $endColor, float $value, float $max): Color
14
    {
15
        /* @var RGB $startColor */
16
        Assert::isInstanceOf($startColor, RGB::class, sprintf('startColor needs to be an instance of [%s]', RGB::class));
17
18
        /* @var RGB $endColor */
19
        Assert::isInstanceOf($endColor, RGB::class, sprintf('endColor needs to be an instance of [%s]', RGB::class));
20
21
        $step = $value / $max;
22
23
        $red = $startColor->getRed() + ($endColor->getRed() - $startColor->getRed()) * $step;
24
        $green = $startColor->getGreen() + ($endColor->getGreen() - $startColor->getGreen()) * $step;
25
        $blue = $startColor->getBlue() + ($endColor->getBlue() - $startColor->getBlue()) * $step;
26
27
        return new RGB((int) round($red), (int) round($green), (int) round($blue));
28
    }
29
30
    public function supports(string $fqcn): bool
31
    {
32
        return RGB::class === $fqcn;
33
    }
34
}
35