public function confirm(string $text, string $default = 'y'): bool
    {
        $choice = $this->choice($text, ['y', 'n'], $default, false);

        return \strtolower($choice[0] ?? $default) === 'y';
    }
public function confirm(string $text, string $default = 'y'): bool
    {
        $choice = $this->choice($text, ['y', 'n'], $default, false);

        return \strtolower($choice[0] ?? $default) === 'y';
    }
public function confirm ( string $ text , string $ default = 'y' ) : bool { $ choice = $ this -> choice ( $ text , [ 'y' , 'n' ] , $ default , false ) ; return \ strtolower ( $ choice [ 0 ] ?? $ default ) === 'y' ; }
Confirms if user agrees to prompt as indicated by given text.

@param string $text    Eg: `Are you sure?`
@param string $default One of `y|n`

@return bool
Confirms if user agrees to prompt as indicated by given text .