HEX
Server: Apache/2.4.41 (Ubuntu)
System: Linux ip-172-31-42-149 5.15.0-1084-aws #91~20.04.1-Ubuntu SMP Fri May 2 07:00:04 UTC 2025 aarch64
User: ubuntu (1000)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /var/www/vhost/disk-apps/magento.bikenow.co/vendor/laminas/laminas-console/src/Prompt/Confirm.php
<?php

/**
 * @see       https://github.com/laminas/laminas-console for the canonical source repository
 * @copyright https://github.com/laminas/laminas-console/blob/master/COPYRIGHT.md
 * @license   https://github.com/laminas/laminas-console/blob/master/LICENSE.md New BSD License
 */

namespace Laminas\Console\Prompt;

class Confirm extends Char
{
    /**
     * @var string
     */
    protected $promptText = 'Are you sure?';

    /**
     * @var string
     */
    protected $allowedChars = 'yn';

    /**
     * @var string
     */
    protected $yesChar = 'y';

    /**
     * @var string
     */
    protected $noChar = 'n';

    /**
     * @var bool
     */
    protected $ignoreCase = true;

    /**
     * Ask the user for a single key stroke
     *
     * @param string    $promptText     The prompt text to display in console
     * @param string    $yesChar        The "yes" key (defaults to Y)
     * @param string    $noChar         The "no" key (defaults to N)
     */
    public function __construct(
        $promptText = 'Are you sure?',
        $yesChar = 'y',
        $noChar = 'n'
    ) {
        if ($promptText !== null) {
            $this->setPromptText($promptText);
        }

        if ($yesChar !== null) {
            $this->setYesChar($yesChar);
        }

        if ($noChar !== null) {
            $this->setNoChar($noChar);
        }
    }

    /**
     * Show the confirmation message and return result.
     *
     * @return bool
     */
    public function show()
    {
        $char = parent::show();
        if ($this->ignoreCase) {
            $response = strtolower($char) === strtolower($this->yesChar);
        } else {
            $response = $char === $this->yesChar;
        }
        return $this->lastResponse = $response;
    }

    /**
     * @param string $noChar
     */
    public function setNoChar($noChar)
    {
        $this->noChar = $noChar;
        $this->setAllowedChars($this->yesChar . $this->noChar);
    }

    /**
     * @return string
     */
    public function getNoChar()
    {
        return $this->noChar;
    }

    /**
     * @param string $yesChar
     */
    public function setYesChar($yesChar)
    {
        $this->yesChar = $yesChar;
        $this->setAllowedChars($this->yesChar . $this->noChar);
    }

    /**
     * @return string
     */
    public function getYesChar()
    {
        return $this->yesChar;
    }
}