Code Duplication    Length = 16-16 lines in 3 locations

src/data/color/type.php 1 location

@@ 40-55 (lines=16) @@
37
	 * @param  array  $color The color in question
38
	 * @return string        The color type as a string, returns 'error' if $color is invalid
39
	 */
40
	public static function _array(array $color) :string {
41
		$color = array_change_key_case($color);
42
		unset($color['a']); // ignore alpha channel
43
		ksort($color);
44
		$type  = implode('', array_keys($color));
45
		$types = [
46
			'bgr'  => 'rgb',
47
			'hls'  => 'hsl',
48
			'bhs'  => 'hsb',
49
			'ckmy' => 'cmyk'
50
		];
51
		if (isset($types[$type])) {
52
			return $types[$type];
53
		}
54
		return 'error';
55
	}
56
}
57

src/data/store.old.php 1 location

@@ 140-155 (lines=16) @@
137
	 * @param  array  $color The color in question
138
	 * @return string        The color type as a string, returns 'error' if $color is invalid
139
	 */
140
	protected static function _get_array_type(array $color) :string {
141
		$color = array_change_key_case($color);
142
		unset($color['a']); // ignore alpha channel
143
		ksort($color);
144
		$type  = implode('', array_keys($color));
145
		$types = [
146
			'bgr'  => 'rgb',
147
			'hls'  => 'hsl',
148
			'bhs'  => 'hsb',
149
			'ckmy' => 'cmyk'
150
		];
151
		if (isset($types[$type])) {
152
			return $types[$type];
153
		}
154
		return 'error';
155
	}
156
	
157
	/**
158
	 * Get (and set) the alpha channel

src/data/type.php 1 location

@@ 40-55 (lines=16) @@
37
	 * @param  array  $color The color in question
38
	 * @return string        The color type as a string, returns 'error' if $color is invalid
39
	 */
40
	public static function _array(array $color) :string {
41
		$color = array_change_key_case($color);
42
		unset($color['a']); // ignore alpha channel
43
		ksort($color);
44
		$type  = implode('', array_keys($color));
45
		$types = [
46
			'bgr'  => 'rgb',
47
			'hls'  => 'hsl',
48
			'bhs'  => 'hsb',
49
			'ckmy' => 'cmyk'
50
		];
51
		if (isset($types[$type])) {
52
			return $types[$type];
53
		}
54
		return 'error';
55
	}
56
	
57
	public static function _object($color) :string {
58
		if (is_object($color) && is_a($color, __NAMESPACE__.'\\store')) {