<commit_before><?php

namespace org\octris\core\app\cli {
    /****c* cli/readline
     * NAME
     *      readline
     * FUNCTION
     *      readline wrapper and fallback, if no readline is available
     * COPYRIGHT
     *      copyright (c) 2010 by <NAME>
     * AUTHOR
     *      <NAME> <<EMAIL>>
     ****
     */

    class readline {
        /****m* readline/__construct
         * SYNOPSIS
         */
        public function __construct()
        /*
         * FUNCTION
         *      constructor
         ****
         */
        {
        }
        
        /****m* readline/get
         * SYNOPSIS
         */
        public function get($prompt = '')
        /*
         * FUNCTION
         *      get user input from stdin
         * INPUTS
         *      * $prompt (string) -- (optional) prompt to print
         * OUTPUTS
         *      (string) -- read user input
         ****
         */
        {
            $return = false;
            
            print $prompt;
            
            if (($fh = fopen('php://stdin', 'r'))) {
                $return = trim(fgets($fh));
                fclose($fh);
            }
            
            return $return;
        }
    }
}<commit_msg>- improvement to allow default value for prompt<commit_after><?php

namespace org\octris\core\app\cli {
    /****c* cli/readline
     * NAME
     *      readline
     * FUNCTION
     *      readline wrapper and fallback, if no readline is available
     * COPYRIGHT
     *      copyright (c) 2010 by <NAME>
     * AUTHOR
     *      <NAME> <<EMAIL>>
     ****
     */

    class readline {
        /****m* readline/__construct
         * SYNOPSIS
         */
        public function __construct()
        /*
         * FUNCTION
         *      constructor
         ****
         */
        {
        }
        
        /****m* readline/get
         * SYNOPSIS
         */
        public function get($prompt = '', $default = '')
        /*
         * FUNCTION
         *      get user input from stdin
         * INPUTS
         *      * $prompt (string) -- (optional) prompt to print
         *      * $default (string) -- (optional) default value
         * OUTPUTS
         *      (string) -- read user input
         ****
         */
        {
            $return = false;
            
            printf($prompt, $default);
            
            if (($fh = fopen('php://stdin', 'r'))) {
                $return = rtrim(fgets($fh), "\r\n");
                fclose($fh);
            }
            
            return ($return == '' ? $default : trim($return));
        }
    }
}
{'fraction_non_alphanumeric': 0.12928049249711426, 'fraction_numerical': 0.0030781069642170067, 'mean_word_length': 1.058590657165479, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 11, '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': '904123', 'n_tokens_mistral': 748, 'n_tokens_neox': 717, 'n_words': 162}