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.

HSL   A
last analyzed

Complexity

Total Complexity 10

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 16
c 1
b 0
f 0
dl 0
loc 38
ccs 17
cts 17
cp 1
rs 10
wmc 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getLightness() 0 3 1
A getSaturation() 0 3 1
A getHue() 0 3 1
B __construct() 0 17 7
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Artack\Color\Color;
6
7
use Artack\Color\Exception\InvalidArgumentException;
8
9
class HSL extends Color
10
{
11
    private $hue;
12
    private $saturation;
13
    private $lightness;
14
15 143
    public function __construct(int $hue, float $saturation, float $lightness)
16
    {
17 143
        if ($hue < 0 || $hue > 360) {
18 1
            throw new InvalidArgumentException(sprintf('Given hue value %d is expected to be between %d and %d >> [%2$d,%3$d]', $hue, 0, 360));
19
        }
20
21 142
        if (((int) floor($saturation)) < 0 || ((int) ceil($saturation)) > 100) {
22 2
            throw new InvalidArgumentException(sprintf('Given saturation value %f must be between %d and %d >> [%2$d, %3$d]', $saturation, 0, 100));
23
        }
24
25 140
        if (((int) floor($lightness)) < 0 || ((int) ceil($lightness)) > 100) {
26 2
            throw new InvalidArgumentException(sprintf('Given lightness value %f must be between %d and %d >> [%2$d, %3$d]', $lightness, 0, 100));
27
        }
28
29 138
        $this->hue = $hue;
30 138
        $this->saturation = $saturation;
31 138
        $this->lightness = $lightness;
32 138
    }
33
34 138
    public function getHue(): int
35
    {
36 138
        return $this->hue;
37
    }
38
39 138
    public function getSaturation(): float
40
    {
41 138
        return $this->saturation;
42
    }
43
44 138
    public function getLightness(): float
45
    {
46 138
        return $this->lightness;
47
    }
48
}
49