Webmozart\Console\Api\IO\Input::read PHP Method

read() public method

Reads the given amount of characters from the input stream.
public read ( integer $length, string $default = null ) : string
$length integer The number of characters to read.
$default string The default to return if interaction is disabled.
return string The characters read from the input stream.
    public function read($length, $default = null)
    {
        if (!$this->interactive) {
            return $default;
        }
        return $this->stream->read($length);
    }

Usage Example

Example #1
0
 /**
  * Reads the given amount of characters from the standard input.
  *
  * @param int    $length  The number of characters to read.
  * @param string $default The default to return if interaction is disabled.
  *
  * @return string The characters read from the input.
  *
  * @throws IOException If reading fails or if the standard input is closed.
  */
 public function read($length, $default = null)
 {
     return $this->input->read($length, $default);
 }
All Usage Examples Of Webmozart\Console\Api\IO\Input::read