public static function validate(array $points, $degree) : bool
{
if (count($points) != $degree) {
throw new Exception\BadDataException("You need to have {$degree} sets of coordinates (arrays) for this technique");
}
$x_coordinates = [];
foreach ($points as $point) {
if (count($point) !== 2) {
throw new Exception\BadDataException('Each array needs to have have precisely two numbers, an x- and y-component');
}
$x_component = $point[self::X];
if (in_array($x_component, $x_coordinates)) {
throw new Exception\BadDataException('Not a function. Your input array contains more than one coordinate with the same x-component.');
}
array_push($x_coordinates, $x_component);
}
return true;
}