Code Duplication    Length = 10-10 lines in 2 locations

src/generate.php 2 locations

@@ 175-184 (lines=10) @@
172
	 * @param  float  $hue The hue to convert
173
	 * @return float       The resulting Y
174
	 */
175
	public static function hue_to_yiq(float $hue) :float {
176
		if ($hue < 60) {
177
			return $hue * 2.5254237288136;
178
		} elseif ($hue < 180) {
179
			return 150 + ($hue - 60) * 4.9243697478992;
180
		} elseif ($hue < 300) {
181
			return 737 + ($hue - 180) * 0.94957983193277;
182
		}
183
		return 851 + ($hue - 300) * 2.5254237288136;
184
	}
185
	
186
	/**
187
	 * Converts a "Y" to the hue spectrum
@@ 192-201 (lines=10) @@
189
	 * @param  float  $yiq The "Y" to convert
190
	 * @return float       The resulting hue
191
	 */
192
	public static function yiq_to_hue(float $yiq) :float {
193
		if ($yiq < 150) {
194
			return $yiq * 0.39597315436242;
195
		} elseif ($yiq < 737) {
196
			return 60 + ($yiq - 150) * 0.20307167235495;
197
		} elseif ($yiq < 851) {
198
			return 180 + ($yiq - 737) * 1.0530973451327;
199
		}
200
		return 300 + ($yiq - 851) * 0.39597315436242;
201
	}
202
}
203