static function isValid($unit, $throw = false)
    {
        if (in_array($unit, static::getUnits(), true)) {
            return true;
        }

        if ($throw) {
            throw new InvalidArgumentException("Invalid unit '$unit'.");
        }

        return false;
    }