Code Duplication    Length = 8-10 lines in 6 locations

src/DataTypes/Light/HsbkColor.php 4 locations

@@ 18-25 (lines=8) @@
15
     * @param int $hue
16
     * @throws InvalidValueException
17
     */
18
    private function setHue(int $hue): void
19
    {
20
        if ($hue < 0 || $hue > 65535) {
21
            throw new InvalidValueException("Value '{$hue}' for hue outside range of allowable values 0 - 65535");
22
        }
23
24
        $this->hue = $hue;
25
    }
26
27
    /**
28
     * @param int $saturation
@@ 31-40 (lines=10) @@
28
     * @param int $saturation
29
     * @throws InvalidValueException
30
     */
31
    private function setSaturation(int $saturation): void
32
    {
33
        if ($saturation < 0 || $saturation > 65535) {
34
            throw new InvalidValueException(
35
                "Value '{$saturation}' for saturation outside range of allowable values 0 - 65535"
36
            );
37
        }
38
39
        $this->saturation = $saturation;
40
    }
41
42
    /**
43
     * @param int $brightness
@@ 46-55 (lines=10) @@
43
     * @param int $brightness
44
     * @throws InvalidValueException
45
     */
46
    private function setBrightness(int $brightness): void
47
    {
48
        if ($brightness < 0 || $brightness > 65535) {
49
            throw new InvalidValueException(
50
                "Value '{$brightness}' for brightness outside range of allowable values 0 - 65535"
51
            );
52
        }
53
54
        $this->brightness = $brightness;
55
    }
56
57
    /**
58
     * @param int $temperature
@@ 61-70 (lines=10) @@
58
     * @param int $temperature
59
     * @throws InvalidValueException
60
     */
61
    private function setTemperature(int $temperature): void
62
    {
63
        if ($temperature < 2500 || $temperature > 9500) {
64
            throw new InvalidValueException(
65
                "Value '{$temperature}' for temperature outside range of allowable values 2500 - 9500"
66
            );
67
        }
68
69
        $this->temperature = $temperature;
70
    }
71
72
    /**
73
     * @param int $hue

src/DataTypes/Light/PowerTransition.php 1 location

@@ 18-25 (lines=8) @@
15
     * @param int $level
16
     * @throws InvalidValueException
17
     */
18
    private function setLevel(int $level): void
19
    {
20
        if ($level < 0 || $level > 65535) {
21
            throw new InvalidValueException("Power level {$level} outside allowable range of 0 - 65535");
22
        }
23
24
        $this->level = $level;
25
    }
26
27
    /**
28
     * @param int $duration

src/DataTypes/Light/State.php 1 location

@@ 23-30 (lines=8) @@
20
     * @param int $power
21
     * @throws InvalidValueException
22
     */
23
    private function setPower(int $power): void
24
    {
25
        if ($power < 0 || $power > 65535) {
26
            throw new InvalidValueException("Power level {$power} outside allowable range of 0 - 65535");
27
        }
28
29
        $this->power = $power;
30
    }
31
32
    private function setLabel(Label $label): void
33
    {