<?php
namespace exussum12\CoverageChecker;
use XMLReader;
class XMLReport
{
protected $file;
public function __construct($file)
{
$this->file = $file;
}
public function getCoveredLines()
{
$coveredLines = [];
$reader = new XMLReader;
$reader->open($this->file);
while ($reader->read()) {
if ((
$reader->name === "file" &&
$reader->nodeType == XMLReader::ELEMENT
)) {
$currentFile = $reader->getAttribute('name');
$coveredLines[$currentFile] = [];
}
if ((
$reader->name === "line" &&
$reader->getAttribute("type") == "stmt"
)) {
$coveredLines
[$currentFile]
[$reader->getAttribute('num')]
= (int) $reader->getAttribute("count");
}
}
return $coveredLines;
}
}
- Output for 5.6.0 - 5.6.29, 7.0.0 - 7.0.20, 7.1.0 - 7.1.20, 7.2.6 - 7.2.33, 7.3.16 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.30, 8.2.0 - 8.2.25, 8.3.0 - 8.3.14, 8.4.1
preferences:
61.14 ms | 408 KiB | 5 Q