__construct() 공개 메소드

Creates an I/O based on the given input and outputs.
public __construct ( Input $input, Output $output, Output $errorOutput )
$input Input The standard input.
$output Output The standard output.
$errorOutput Output The error output.
예제 #1
0
 /**
  * Creates the I/O.
  *
  * @param string    $inputData The data to return from the input.
  * @param Formatter $formatter The formatter to use.
  */
 public function __construct($inputData = '', Formatter $formatter = null)
 {
     $formatter = $formatter ?: new PlainFormatter();
     $input = new Input(new StringInputStream($inputData));
     $output = new Output(new BufferedOutputStream(), $formatter);
     $errorOutput = new Output(new BufferedOutputStream(), $formatter);
     parent::__construct($input, $output, $errorOutput);
 }
예제 #2
0
 /**
  * Creates the I/O.
  *
  * @param Input  $input       The standard input.
  * @param Output $output      The standard output.
  * @param Output $errorOutput The error output.
  */
 public function __construct(Input $input = null, Output $output = null, Output $errorOutput = null)
 {
     if (null === $input) {
         $inputStream = new StandardInputStream();
         $input = new Input($inputStream);
     }
     if (null === $output) {
         $outputStream = new StandardOutputStream();
         $formatter = $outputStream->supportsAnsi() ? new AnsiFormatter() : new PlainFormatter();
         $output = new Output($outputStream, $formatter);
     }
     if (null === $errorOutput) {
         $errorStream = new ErrorOutputStream();
         $formatter = $errorStream->supportsAnsi() ? new AnsiFormatter() : new PlainFormatter();
         $errorOutput = new Output($errorStream, $formatter);
     }
     parent::__construct($input, $output, $errorOutput);
 }