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 InvalidArgumentException();
}
$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;
}
}
}