src/Installer.php
public function askYesNo(string $prompt)
    {
        $prompt .= ' (y/n): ';
        $result = null;

        $result = $this->askUntillValid($prompt, function($answer) {
            /* Lowercase user prompt */
            $answer = strtolower($answer);

            /* Correrct answer is y or n */
            return $answer === 'y' || $answer === 'n';
        });

        return $result === 'y';
    }
public function askYesNo(string $prompt)
    {
        $prompt .= ' (y/n): ';
        $result = null;

        $result = $this->askUntillValid($prompt, function($answer) {
            /* Lowercase user prompt */
            $answer = strtolower($answer);

            /* Correrct answer is y or n */
            return $answer === 'y' || $answer === 'n';
        });

        return $result === 'y';
    }
public function askYesNo ( string $ prompt ) { $ prompt .= ' (y/n): ' ; $ result = null ; $ result = $ this -> askUntillValid ( $ prompt , function ( $ answer ) { /* Lowercase user prompt */ $ answer = strtolower ( $ answer ) ; /* Correrct answer is y or n */ return $ answer === 'y' || $ answer === 'n' ; } ) ; return $ result === 'y' ; }
Prompt user to supply either a yes or no answer

@param string $prompt the prompt message
@return bool user answer, y = true : n = false
Prompt user to supply either a yes or no answer