$numValues) { if ($name) { $name = $name . ': '; } throw new Exception("${name}expecting at least $expectedMinArgs arguments, got $numValues"); } return $values; } /** * Checks that the value is a number and returns it as float * * @param array $value The parsed value triplet * @param string $error The error message to throw * @throws Exception */ public static function assertNumber(array $value, string $error = 'expecting number'): float { if ($value[0] == 'number') return (float)$value[1]; throw new Exception($error); } /** * @throws Exception */ public static function assertColor(array $value, $error = 'expected color value'): array { $color = Color::coerceColor($value); if (is_null($color)) throw new Exception($error); return $color; } }