You are here

public function PHPUnit_Util_Printer::__construct in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/phpunit/phpunit/src/Util/Printer.php \PHPUnit_Util_Printer::__construct()

Constructor.

Parameters

mixed $out:

Throws

PHPUnit_Framework_Exception

4 calls to PHPUnit_Util_Printer::__construct()
PHPUnit_TextUI_ResultPrinter::__construct in vendor/phpunit/phpunit/src/TextUI/ResultPrinter.php
Constructor.
PHPUnit_Util_Log_JUnit::__construct in vendor/phpunit/phpunit/src/Util/Log/JUnit.php
Constructor.
PHPUnit_Util_Log_TAP::__construct in vendor/phpunit/phpunit/src/Util/Log/TAP.php
Constructor.
PHPUnit_Util_TestDox_ResultPrinter::__construct in vendor/phpunit/phpunit/src/Util/TestDox/ResultPrinter.php
Constructor.
4 methods override PHPUnit_Util_Printer::__construct()
PHPUnit_TextUI_ResultPrinter::__construct in vendor/phpunit/phpunit/src/TextUI/ResultPrinter.php
Constructor.
PHPUnit_Util_Log_JUnit::__construct in vendor/phpunit/phpunit/src/Util/Log/JUnit.php
Constructor.
PHPUnit_Util_Log_TAP::__construct in vendor/phpunit/phpunit/src/Util/Log/TAP.php
Constructor.
PHPUnit_Util_TestDox_ResultPrinter::__construct in vendor/phpunit/phpunit/src/Util/TestDox/ResultPrinter.php
Constructor.

File

vendor/phpunit/phpunit/src/Util/Printer.php, line 46

Class

PHPUnit_Util_Printer
Utility class that can print to STDOUT or write to a file.

Code

public function __construct($out = null) {
  if ($out !== null) {
    if (is_string($out)) {
      if (strpos($out, 'socket://') === 0) {
        $out = explode(':', str_replace('socket://', '', $out));
        if (sizeof($out) != 2) {
          throw new PHPUnit_Framework_Exception();
        }
        $this->out = fsockopen($out[0], $out[1]);
      }
      else {
        if (strpos($out, 'php://') === false && !is_dir(dirname($out))) {
          mkdir(dirname($out), 0777, true);
        }
        $this->out = fopen($out, 'wt');
      }
      $this->outTarget = $out;
    }
    else {
      $this->out = $out;
    }
  }
}