PhpBench\Util\TimeUnit::validateUnit PHP Method

validateUnit() private static method

private static validateUnit ( $unit )
    private static function validateUnit($unit)
    {
        if (!is_string($unit)) {
            throw new \InvalidArgumentException(sprintf('Expected string value for time unit, got "%s"', is_object($unit) ? get_class($unit) : gettype($unit)));
        }
        if (!isset(self::$map[$unit])) {
            throw new \InvalidArgumentException(sprintf('Invalid time unit "%s", available units: "%s"', $unit, implode('", "', array_keys(self::$map))));
        }
    }