read() 공개 메소드

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.
리턴 string The characters read from the input stream.
예제 #1
0
파일: IO.php 프로젝트: webmozart/console
 /**
  * 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);
 }
예제 #2
0
 public function testReadReturnsDefaultIfNotInteractive()
 {
     $this->stream->set('Lorem ipsum');
     $this->input->setInteractive(false);
     $this->assertSame('Default', $this->input->read(20, 'Default'));
 }