Webmozart\Console\Api\IO\Output::write PHP 메소드

write() 공개 메소드

The string is formatted before it is written to the output stream.
public write ( string $string, integer $flags = null )
$string string The string to write.
$flags integer The flags. If one of of {@link IO::VERBOSE}, {@link IO::VERY_VERBOSE} and {@link IO::DEBUG} is passed, the output is only written if the verbosity level is the given level or higher.
    public function write($string, $flags = null)
    {
        if ($this->mayWrite($flags)) {
            $formatted = $this->formatOutput ? $this->format($string) : $this->removeFormat($string);
            $this->stream->write($formatted);
        }
    }

Usage Example

예제 #1
0
 public function testWriteRemovesTagsIfAnsiNotSupported()
 {
     $stream = $this->getMockBuilder('Webmozart\\Console\\IO\\OutputStream\\BufferedOutputStream')->setMethods(array('supportsAnsi'))->getMock();
     $stream->expects($this->any())->method('supportsAnsi')->willReturn(false);
     $ansiFormatter = $this->getMockBuilder('Webmozart\\Console\\Formatter\\AnsiFormatter')->setMethods(array('format', 'removeFormat'))->getMock();
     $ansiFormatter->expects($this->once())->method('removeFormat')->with('<tag>text</tag>')->willReturn('text');
     $this->output->setStream($stream);
     $this->output->setFormatter($ansiFormatter);
     $this->output->write('<tag>text</tag>');
     $this->assertSame('text', $stream->fetch());
 }
All Usage Examples Of Webmozart\Console\Api\IO\Output::write