Code Duplication    Length = 9-9 lines in 4 locations

src/main.php 4 locations

@@ 48-56 (lines=9) @@
45
		return $color + ['a' => $this->color->alpha()];
46
	}
47
	
48
	public function cmyk() :array {
49
		if (!is_null($cached = $this->cache->get(__FUNCTION__, $this->hex()))) {
50
			return $cached;
51
		}
52
		$rgb    = $this->color->rgb;
53
		$result = convert::rgb_to_cmyk($rgb['r'], $rgb['g'], $rgb['b']) + ['a' => $this->color->alpha()];
54
		$this->cache->set(__FUNCTION__, $this->hex(), $result);
55
		return $result;
56
	}
57
	
58
	public function hsb(int $accuracy = 0) :array {
59
		if (!is_null($cached = $this->cache->get(__FUNCTION__, $this->hex()))) {
@@ 58-66 (lines=9) @@
55
		return $result;
56
	}
57
	
58
	public function hsb(int $accuracy = 0) :array {
59
		if (!is_null($cached = $this->cache->get(__FUNCTION__, $this->hex()))) {
60
			return $cached;
61
		}
62
		$rgb    = $this->color->rgb;
63
		$result = convert::rgb_to_hsb($rgb['r'], $rgb['g'], $rgb['b'], $accuracy) + ['a' => $this->color->alpha()];
64
		$this->cache->set(__FUNCTION__, $this->hex(), $result);
65
		return $result;
66
	}
67
	
68
	public function hex() :string {
69
		return $this->color->hex;
@@ 72-80 (lines=9) @@
69
		return $this->color->hex;
70
	}
71
	
72
	public function web_safe() :string {
73
		if (!is_null($cached = $this->cache->get(__FUNCTION__, $this->hex()))) {
74
			return $cached;
75
		}
76
		$rgb    = $this->color->rgb;
77
		$result = generate::web_safe($rgb['r'], $rgb['g'], $rgb['b']);
78
		$this->cache->set(__FUNCTION__, $this->hex(), $result);
79
		return $result;
80
	}
81
	
82
	public function css() :string {
83
		return css::best($this->color);
@@ 96-104 (lines=9) @@
93
		return $this->color->alpha($new_alpha);
94
	}
95
	
96
	public function is_dark(int $check_score = 128) :bool {
97
		if (!is_null($cached = $this->cache->get(__FUNCTION__, $this->hex()))) {
98
			return $cached;
99
		}
100
		$rgb    = $this->color->rgb;
101
		$result = check::is_dark($rgb['r'], $rgb['g'], $rgb['b'], $check_score);
102
		$this->cache->set(__FUNCTION__, $this->hex(), $result);
103
		return $result;
104
	}
105
	
106
	public function red(float $adjustment, bool $as_percentage = FALSE, bool $set_absolute = TRUE) {
107
		return modify::rgb($this->color, 'red', $adjustment, $as_percentage, $set_absolute);