public static function validateLength($type, $value)
    {
        $value = trim($value);

        if (!strlen($value)) {
            return;
        }

        if (in_array($type, self::getDecimalTypes())) {
            if (!preg_match(self::REGEX_LENGTH_DOUBLE, $value)) {
                throw new ApplicationException(Lang::get('rainlab.builder::lang.database.error_table_decimal_length', [
                    'type' => $type
                ]));
            }
        } else {
            if (!preg_match(self::REGEX_LENGTH_SINGLE, $value)) {
                throw new ApplicationException(Lang::get('rainlab.builder::lang.database.error_table_length', [
                    'type' => $type
                ]));
            }
        }
    }