PHP 클래스 Webmozart\Console\Api\IO\Input

This class wraps an input stream and adds convenience functionality for reading that stream.
부터: 1.0
저자: Bernhard Schussek ([email protected])
파일 보기 프로젝트 열기: webmozart/console 1 사용 예제들

공개 메소드들

메소드 설명
__construct ( Webmozart\Console\Api\IO\InputStream $stream ) Creates an input for the given input stream.
close ( ) Closes the input.
getStream ( ) : Webmozart\Console\Api\IO\InputStream Returns the underlying stream.
isClosed ( ) : boolean Returns whether the input is closed.
isInteractive ( ) : boolean Returns whether the user may be asked for input.
read ( integer $length, string $default = null ) : string Reads the given amount of characters from the input stream.
readLine ( string $default = null, integer $length = null ) : string Reads a line from the input stream.
setInteractive ( boolean $interactive ) Enables or disables interaction with the user.
setStream ( Webmozart\Console\Api\IO\InputStream $stream ) Sets the underlying stream.

메소드 상세

__construct() 공개 메소드

Creates an input for the given input stream.
public __construct ( Webmozart\Console\Api\IO\InputStream $stream )
$stream Webmozart\Console\Api\IO\InputStream The input stream.

close() 공개 메소드

Closes the input.
public close ( )

getStream() 공개 메소드

Returns the underlying stream.
public getStream ( ) : Webmozart\Console\Api\IO\InputStream
리턴 Webmozart\Console\Api\IO\InputStream The input stream.

isClosed() 공개 메소드

Returns whether the input is closed.
public isClosed ( ) : boolean
리턴 boolean Returns `true` if the input is closed and `false` otherwise.

isInteractive() 공개 메소드

Returns whether the user may be asked for input.
public isInteractive ( ) : boolean
리턴 boolean Returns `true` if the user may be asked for input and `false` otherwise.

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.

readLine() 공개 메소드

Reads a line from the input stream.
public readLine ( string $default = null, integer $length = null ) : string
$default string The default to return if interaction is disabled.
$length integer The maximum number of characters to read. If `null`, all characters up to the first newline are returned.
리턴 string The characters read from the input stream.

setInteractive() 공개 메소드

Enables or disables interaction with the user.
public setInteractive ( boolean $interactive )
$interactive boolean Whether the inputmay interact with the user. If set to `false`, all calls to {@link read()} and {@link readLine()} will immediately return the default value.

setStream() 공개 메소드

Sets the underlying stream.
public setStream ( Webmozart\Console\Api\IO\InputStream $stream )
$stream Webmozart\Console\Api\IO\InputStream The input stream.