Code Duplication    Length = 33-33 lines in 2 locations

src/CustomScreen/Model/ModelAbstract.php 1 location

@@ 69-101 (lines=33) @@
66
     *
67
     * @return string
68
     */
69
    public function getMonoColor(int $tone = null)
70
    {
71
        if (is_null($tone)) {
72
            return 'None';
73
        }
74
        $tTones = [
75
            'White',
76
            'Light6',
77
            'Light5',
78
            'Light4',
79
            'Light3',
80
            'Light2',
81
            'Light1',
82
            'LightGray',
83
            'Gray',
84
            'Dark1',
85
            'Dark2',
86
            'Dark3',
87
            'Dark4',
88
            'Dark5',
89
            'Dark6',
90
            'Black',
91
        ];
92
        $levels = count($tTones);
93
        $index  = (int)ceil($levels * $tone / 100) - 1;
94
        if ($index < 0) {
95
            $index = 0;
96
        } elseif ($index >= $levels) {
97
            $index = $levels - 1;
98
        }
99
100
        return $tTones[$index];
101
    }
102
}
103

src/Helper/Color.php 1 location

@@ 37-69 (lines=33) @@
34
     *
35
     * @return string
36
     */
37
    private function toGreyScale(int $tone = null)
38
    {
39
        if (is_null($tone)) {
40
            return 'None';
41
        }
42
        $tTones = [
43
            'White',
44
            'Light6',
45
            'Light5',
46
            'Light4',
47
            'Light3',
48
            'Light2',
49
            'Light1',
50
            'LightGray',
51
            'Gray',
52
            'Dark1',
53
            'Dark2',
54
            'Dark3',
55
            'Dark4',
56
            'Dark5',
57
            'Dark6',
58
            'Black',
59
        ];
60
        $levels = count($tTones);
61
        $index  = (int)ceil($levels * $tone / 100) - 1;
62
        if ($index < 0) {
63
            $index = 0;
64
        } elseif ($index >= $levels) {
65
            $index = $levels - 1;
66
        }
67
68
        return $tTones[$index];
69
    }
70
71
    public function get()
72
    {