Phrozn\Outputter\PlainOutputter::stdout PHP Method

stdout() public method

Writes the message $msg to STDOUT.
public stdout ( string $msg, string $status = self::STATUS_OK ) : Phrozn\Outputter
$msg string The message to output
$status string Ignored
return Phrozn\Outputter
    public function stdout($msg, $status = self::STATUS_OK)
    {
        if (defined('STDOUT')) {
            fwrite(STDOUT, $msg);
        } else {
            echo $msg;
            if (count(\ob_get_status()) !== 0) {
                ob_flush();
            }
        }
        return $this;
    }

Usage Example

 public function testStdOutWithResource()
 {
     $fp = fopen('/tmp/stdout', 'w+');
     define('STDOUT', $fp);
     fclose($fp);
     $outputter = new Outputter();
     $outputter->stdout('sending output', '');
     $this->assertSame('sending output', trim(file_get_contents('/tmp/stdout')));
 }
All Usage Examples Of Phrozn\Outputter\PlainOutputter::stdout
PlainOutputter