<commit_before><?php

require_once "PEAR.php";

class PEAR_CommandUI_CLI extends PEAR
{
    var $output_mode = 'plain';
    var $output_mode_params = array();

    function PEAR_CommandUI_CLI()
    {
        parent::PEAR();
    }

    function _PEAR_CommandUI_CLI()
    {
        parent::_PEAR();
        if ($this->output_mode) {
            $this->endOutput();
        }
    }

    function displayLine($text)
    {
        print "$text\n";
    }

    function userDialog($prompt, $type = 'text')
    {
        if ($type == 'password') {
            system('stty -echo');
        }
        print "$prompt : ";
        $fp = fopen("php://stdin", "r");
        $line = fgets($fp, 2048);
        fclose($fp);
        if ($type == 'password') {
            system('stty echo');
            print "\n";
        }
        return $line;
    }

    function userConfirm($prompt, $default = 'yes')
    {
        static $positives = array('y', 'yes', 'on', '1');
        static $negatives = array('n', 'no', 'off', '0');<commit_msg>* add optional default parameter to userDialog method<commit_after><?php

require_once "PEAR.php";

class PEAR_CommandUI_CLI extends PEAR
{
    var $output_mode = 'plain';
    var $output_mode_params = array();

    function PEAR_CommandUI_CLI()
    {
        parent::PEAR();
    }

    function _PEAR_CommandUI_CLI()
    {
        parent::_PEAR();
        if ($this->output_mode) {
            $this->endOutput();
        }
    }

    function displayLine($text)
    {
        print "$text\n";
    }

    function userDialog($prompt, $type = 'text', $default = '')
    {
        if ($type == 'password') {
            system('stty -echo');
        }
        print "$prompt ";
        if ($default) {
            print "[$default] ";
        }
        print ": ";
        $fp = fopen("php://stdin", "r");
        $line = fgets($fp, 2048);
        fclose($fp);
        if ($type == 'password') {
            system('stty echo');
            print "\n";
        }
        if ($default && trim($line) == "") {
            return $default;
        }
        return $line;
    }

    function userConfirm($prompt, $default = 'yes')
    {
        static $positives = array('y', 'yes', 'on', '1');
        static $negatives = array('n', 'no', 'off', '0');
{'fraction_non_alphanumeric': 0.17077464788732394, 'fraction_numerical': 0.00528169014084507, 'mean_word_length': 1.8555276381909547, 'pattern_counts': {'":': 1, '<': 5, '<?xml version=': 0, '>': 7, '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': '5286982', 'n_tokens_mistral': 739, 'n_tokens_neox': 718, 'n_words': 155}