<commit_before><?php

namespace kiwi\Http;

class Rule
{
    /**
     * Set a minimum string length rule.
     *
     * @param string $string
     * @param int    $offset
     *
     * @return bool
     */
    public static function min($string, $offset)
    {
        return strlen($string) >= $offset;
    }

    /**
     * Set a maximum string length rule.
     *
     * @param string $string
     * @param int    $offset
     *
     * @return bool
     */
    public static function max($string, $offset)
    {
        return strlen($string) <= $offset;
    }

    /**
     * Set a required rule.
     *
     * @param string $string
     *
     * @return bool
     */
    public static function required($string)
    {
        return !empty($string);
    }

    /**
     * Set a email validation rule.
     *
     * @param string $string
     *
     * @return bool
     */
    public static function email($string)
    {
        return filter_var($string, FILTER_VALIDATE_EMAIL);
    }

    /**
     * Set a alphabetical only rule.
     *
     * @param  string $string
     * @return bool
     */
    public static function alpha($string)
    {
        return preg_match('/^[A-Za-zÅÄÖåäö]+$/', $string) === true;
    }
}
<commit_msg>add rule for url<commit_after><?php

namespace kiwi\Http;

class Rule
{
    /**
     * Set a minimum string length rule.
     *
     * @param string $string
     * @param int    $offset
     *
     * @return bool
     */
    public static function min($string, $offset)
    {
        return strlen($string) >= $offset;
    }

    /**
     * Set a maximum string length rule.
     *
     * @param string $string
     * @param int    $offset
     *
     * @return bool
     */
    public static function max($string, $offset)
    {
        return strlen($string) <= $offset;
    }

    /**
     * Set a required rule.
     *
     * @param string $string
     *
     * @return bool
     */
    public static function required($string)
    {
        return !empty($string);
    }

    /**
     * Set a email validation rule.
     *
     * @param string $string
     *
     * @return bool
     */
    public static function email($string)
    {
        return filter_var($string, FILTER_VALIDATE_EMAIL);
    }

    /**
     * Set a URL validation rule.
     *
     * @param  string $string
     * @return bool
     */
    public static function url($string)
    {
        return filter_var($string, FILTER_VALIDATE_URL);
    }

    /**
     * Set a alphabetical only rule.
     *
     * @param  string $string
     * @return bool
     */
    public static function alpha($string)
    {
        return preg_match('/^[A-Za-zÅÄÖåäö]+$/', $string) === true;
    }
}

{'fraction_non_alphanumeric': 0.12435040831477358, 'fraction_numerical': 0.0, 'mean_word_length': 1.6976976976976976, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4201481', 'n_tokens_mistral': 841, 'n_tokens_neox': 822, 'n_words': 218}