Liip\RMT\Information\InteractiveQuestion::getFormatedText PHP Method

getFormatedText() public method

public getFormatedText ( )
    public function getFormatedText()
    {
        if ($this->informationRequest->getOption('type') == 'confirmation') {
            $text = 'Please confirm that ';
        } else {
            $text = 'Please provide ';
        }
        $text .= strtolower($this->informationRequest->getOption('description'));
        if ($this->informationRequest->getOption('type') == 'choice') {
            $text .= "\n" . $this->formatChoices($this->informationRequest->getOption('choices'), $this->informationRequest->getOption('choices_shortcuts'));
        }
        // print the default if exist
        if ($this->hasDefault()) {
            $defaultVal = $this->getDefault();
            if (is_bool($defaultVal)) {
                $defaultVal = $defaultVal === true ? 'true' : 'false';
            }
            $text .= ' (default: <info>' . $defaultVal . '</info>)';
        }
        return $text . ': ';
    }

Usage Example

Esempio n. 1
0
 protected function askQuestion(InteractiveQuestion $question)
 {
     $dialog = $this->getHelperSet()->get('dialog');
     return $dialog->askAndValidate($this->getOutput(), $question->getFormatedText(), $question->getValidator(), false, $question->getDefault());
 }
All Usage Examples Of Liip\RMT\Information\InteractiveQuestion::getFormatedText