public static getPoints ( $source, array $args = [] ) : array | ||
$source | The source of our approximation. Should be either a callback function or a set of arrays. | |
$args | array | The arguments of our callback function: start, end, and n. Example: [0, 8, 5]. If $source is a set of arrays, $args will default to []. |
리턴 | array |
public static function getPoints($source, array $args = []) : array
{
if (is_callable($source)) {
$function = $source;
$start = $args[0];
$end = $args[1];
$n = $args[2];
$points = self::functionToPoints($function, $start, $end, $n);
} elseif (is_array($source)) {
$points = $source;
} else {
throw new Exception\BadDataException('Input source is incorrect. You need to input either a callback function or a set of arrays');
}
return $points;
}