_output = fopen($stream, 'w'); } /** * Outputs a single or multiple messages to stdout. If no parameters * are passed outputs just a newline. * * @param mixed $message A string or a an array of strings to output * @param integer $newlines Number of newlines to append * @return integer Returns the number of bytes returned from writing to stdout. */ public function write($message, $newlines = 1) { if (is_array($message)) { $message = implode(self::LF, $message); } return $this->_write($message . str_repeat(self::LF, $newlines)); } /** * Writes a message to the output stream * * @param string $message Message to write. * @return boolean success */ protected function _write($message) { return fwrite($this->_output, $message); } /** * clean up and close handles * * @return void */ public function __destruct() { fclose($this->_output); } }