<commit_before><?php

/**
 * Html
 *
 * PHP version 5
 *
 * @category  Html
 * @package   Html
 * @author    <NAME> <<EMAIL>>
 * @copyright 2015 <NAME>
 * @license   https://opensource.org/licenses/MIT MIT
 * @link      https://github.com/markroland/composer-boilerplate
 **/

namespace MarkRoland\StringParser;

/**
 * Html Class
 *
 * @category  Html
 * @package   Html
 * @author    <NAME> <<EMAIL>>
 * @copyright 2015 <NAME>
 * @license   https://opensource.org/licenses/MIT MIT
 * @version   Release: @package_version@
 * @link      https://github.com/markroland/composer-boilerplate
 **/
class Html
{

    /**
     * Linkify String
     * @param string $input Input String
     * @return string Replacement result.
     **/
    public static function Linkify($input)
    {

        // Set the default output to be the same as the input
        $output = $input;

        // Replace ?
        $output = self::LinkReplacementOne($output);

        // Replace ?
        $output = self::LinkReplacementTwo($output);

        // Replace email address
        $output = self::ConvertEmail($output);

        return $output;
    }

    /**
     * Convert Email
     * @param string $input Input String
     * @return string Replace result
     **/
    private function LinkReplacementOne($input)
    {
        return preg_replace(
            "/([a-zA-Z]+:\/\/[a-z0-9\_\.\-]+" . "[a-z]{2,6}[a-zA-Z0-9\/\*\-\_\?\&\%\=\,\+\.]+)/",
            '<a href="$1" target="_blank">$1</a>',
            $input
        );
    }

    /**
     * Convert Email
     * @param string $input Input String
     * @return string Replace result
     **/
    private function LinkReplacementTwo($input)
    {
        return preg_replace(
            "/[^a-z]+[^:\/\/](www\." . "[^\.]+[\w][\.|\/][a-zA-Z0-9\/\*\-\_\?\&\%\=\,\+\.]+)/",
            '<a href="$1">$1</a>',
            $input
        );
    }

    /**
     * Convert Email
     * @param string $input Input String
     * @return string Replace result
     **/
    private function ConvertEmail($input)
    {
        return preg_replace(
            "/([\s|\,\>])([a-zA-Z][a-zA-Z0-9\_\.\-]*[a-z" . "A-Z]*\@[a-zA-Z][a-zA-Z0-9\_\.\-]*[a-zA-Z]{2,6})" . "([A-Za-z0-9\!\?\@\#\$\%\^\&\*\(\)\_\-\=\+]*)" . "([\s|\.|\,\<])/i",
            "$1<a href=\"mailto:$2$3$4\">$2</a>$4",
            $input
        );
    }
}<commit_msg>Converted private helper methods to be static<commit_after><?php

/**
 * Html
 *
 * PHP version 5
 *
 * @category  Html
 * @package   Html
 * @author    <NAME> <<EMAIL>>
 * @copyright 2015 <NAME>
 * @license   https://opensource.org/licenses/MIT MIT
 * @link      https://github.com/markroland/composer-boilerplate
 **/

namespace MarkRoland\StringParser;

/**
 * Html Class
 *
 * @category  Html
 * @package   Html
 * @author    <NAME> <<EMAIL>>
 * @copyright 2015 <NAME>
 * @license   https://opensource.org/licenses/MIT MIT
 * @version   Release: @package_version@
 * @link      https://github.com/markroland/composer-boilerplate
 **/
class Html
{

    /**
     * Linkify String
     * @param string $input Input String
     * @return string Replacement result.
     **/
    public static function Linkify($input)
    {

        // Set the default output to be the same as the input
        $output = $input;

        // Replace ?
        $output = self::LinkReplacementOne($output);

        // Replace ?
        $output = self::LinkReplacementTwo($output);

        // Replace email address
        $output = self::ConvertEmail($output);

        return $output;
    }

    /**
     * Convert Email
     * @param string $input Input String
     * @return string Replace result
     **/
    static private function LinkReplacementOne($input)
    {
        return preg_replace(
            "/([a-zA-Z]+:\/\/[a-z0-9\_\.\-]+" . "[a-z]{2,6}[a-zA-Z0-9\/\*\-\_\?\&\%\=\,\+\.]+)/",
            '<a href="$1" target="_blank">$1</a>',
            $input
        );
    }

    /**
     * Convert Email
     * @param string $input Input String
     * @return string Replace result
     **/
    static private function LinkReplacementTwo($input)
    {
        return preg_replace(
            "/[^a-z]+[^:\/\/](www\." . "[^\.]+[\w][\.|\/][a-zA-Z0-9\/\*\-\_\?\&\%\=\,\+\.]+)/",
            '<a href="$1">$1</a>',
            $input
        );
    }

    /**
     * Convert Email
     * @param string $input Input String
     * @return string Replace result
     **/
    static private function ConvertEmail($input)
    {
        return preg_replace(
            "/([\s|\,\>])([a-zA-Z][a-zA-Z0-9\_\.\-]*[a-z" . "A-Z]*\@[a-zA-Z][a-zA-Z0-9\_\.\-]*[a-zA-Z]{2,6})" . "([A-Za-z0-9\!\?\@\#\$\%\^\&\*\(\)\_\-\=\+]*)" . "([\s|\.|\,\<])/i",
            "$1<a href=\"mailto:$2$3$4\">$2</a>$4",
            $input
        );
    }
}
{'fraction_non_alphanumeric': 0.21765569301740406, 'fraction_numerical': 0.014678129586915495, 'mean_word_length': 1.8631452581032413, 'pattern_counts': {'":': 0, '<': 35, '<?xml version=': 0, '>': 33, 'https://': 8, 'lorem ipsum': 0, 'www.': 2, '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': '4280772', 'n_tokens_mistral': 1729, 'n_tokens_neox': 1637, 'n_words': 311}