Color   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 25
dl 0
loc 32
rs 10
c 0
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A random() 0 7 2
1
<?php
2
3
namespace Helix\Asana;
4
5
use Exception;
6
use ReflectionClass;
7
8
/**
9
 * Color constants.
10
 *
11
 * These should not be used for project statuses, they have their own limited set.
12
 */
13
final class Color {
14
15
    const DARK_BLUE = 'dark-blue';
16
    const DARK_BROWN = 'dark-brown';
17
    const DARK_GREEN = 'dark-green';
18
    const DARK_ORANGE = 'dark-orange';
19
    const DARK_PINK = 'dark-pink';
20
    const DARK_PURPLE = 'dark-purple';
21
    const DARK_RED = 'dark-red';
22
    const DARK_TEAL = 'dark-teal';
23
    const DARK_WARM_GRAY = 'dark-warm-gray';
24
    const LIGHT_BLUE = 'light-blue';
25
    const LIGHT_GREEN = 'light-green';
26
    const LIGHT_ORANGE = 'light-orange';
27
    const LIGHT_PINK = 'light-pink';
28
    const LIGHT_PURPLE = 'light-purple';
29
    const LIGHT_RED = 'light-red';
30
    const LIGHT_TEAL = 'light-teal';
31
    const LIGHT_WARM_GRAY = 'light-warm-gray';
32
    const LIGHT_YELLOW = 'light-yellow';
33
    const NONE = 'none';
34
35
    /**
36
     * @return string
37
     */
38
    public static function random (): string {
39
        try {
40
            $colors = (new ReflectionClass(self::class))->getConstants();
41
            return $colors[array_rand($colors)];
42
        }
43
        catch (Exception $exception) {
44
            return 'none'; // unreachable
45
        }
46
    }
47
}