Browscap\Writer\XmlWriter::renderHeader PHP Method

renderHeader() public method

Generate the header
public renderHeader ( array $comments = [] ) : Browscap\Writer\WriterInterface
$comments array
return Browscap\Writer\WriterInterface
    public function renderHeader(array $comments = [])
    {
        if ($this->isSilent()) {
            return $this;
        }
        $this->getLogger()->debug('rendering comments');
        fputs($this->file, '<comments>' . PHP_EOL);
        foreach ($comments as $text) {
            fputs($this->file, '<comment><![CDATA[' . $text . ']]></comment>' . PHP_EOL);
        }
        fputs($this->file, '</comments>' . PHP_EOL);
        return $this;
    }

Usage Example

Example #1
0
 /**
  * tests rendering the header information
  *
  * @group writer
  * @group sourcetest
  */
 public function testRenderHeaderIfNotSilent()
 {
     $mockLogger = $this->getMock('\\Monolog\\Logger', array(), array(), '', false);
     $this->object->setLogger($mockLogger);
     $header = array('TestData to be renderd into the Header');
     $this->object->setSilent(false);
     self::assertSame($this->object, $this->object->renderHeader($header));
     self::assertSame('<comments>' . PHP_EOL . '<comment><![CDATA[TestData to be renderd into the Header]]></comment>' . PHP_EOL . '</comments>' . PHP_EOL, file_get_contents($this->file));
 }
All Usage Examples Of Browscap\Writer\XmlWriter::renderHeader