for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace PhpSchool\CliMenu\Input;
use PhpSchool\CliMenu\MenuStyle;
/**
* @author Aydin Hassan <[email protected]>
*/
class Text implements Input
{
* @var InputIO
private $inputIO;
* @var string
private $promptText = 'Enter text:';
private $validationFailedText = 'Invalid, try again';
private $placeholderText = '';
* @var MenuStyle
private $style;
public function __construct(InputIO $inputIO, MenuStyle $style)
$this->inputIO = $inputIO;
$this->style = $style;
}
public function setPromptText(string $promptText) : Input
$this->promptText = $promptText;
return $this;
public function getPromptText() : string
return $this->promptText;
public function setValidationFailedText(string $validationFailedText) : Input
$this->validationFailedText = $validationFailedText;
public function getValidationFailedText() : string
return $this->validationFailedText;
public function setPlaceholderText(string $placeholderText) : Input
$this->placeholderText = $placeholderText;
public function getPlaceholderText() : string
return $this->placeholderText;
public function ask() : InputResult
return $this->inputIO->collect($this);
public function validate(string $input) : bool
return !empty($input);
public function filter(string $value) : string
return $value;
public function getStyle() : MenuStyle
return $this->style;