src/CLI/CLI.php
public static function input($prompt, $default = null)
    {
        $ret = false;
        while (!$ret)
        {
            if ($prompt)
            {
                echo $prompt;
                if ($default)
                    echo " (" . $default . ")";
                 
                echo ": ";
            }
            $ret = trim(fgets(STDIN));

            if (!$ret && $default !== null)
                return $default;
        }

        return trim($ret);
    }
public static function input($prompt, $default = null)
    {
        $ret = false;
        while (!$ret)
        {
            if ($prompt)
            {
                echo $prompt;
                if ($default)
                    echo " (" . $default . ")";
                 
                echo ": ";
            }
            $ret = trim(fgets(STDIN));

            if (!$ret && $default !== null)
                return $default;
        }

        return trim($ret);
    }
Read from standard input
@param $prompt string The text explaining what input is expected, null to avoid prompt
@param $default string What to return in case the user enters nothing. If not specified,
this function keeps asking until input is provided
@return string The input or default if no input was specified
@codeCoverageIgnore STDIN can't be reliably unit tested - test manually