/** * Tries to determine the expected newline character based on the * platform information passed by the browser's agent header. * * @return string The guessed expected newline characters, either \n, \r * or \r\n. */ public function getNewline() { if (!isset($this->_browser)) { throw new LogicException('Missing browser parameter.'); } switch ($this->_browser->getPlatform()) { case 'win': return "\r\n"; case 'mac': return "\r"; case 'unix': default: return "\n"; } }