Passed
Pull Request — master (#26)
by Scott
02:03
created

PhpMdLoaderStrict::getErrorsOnLine()   A

Complexity

Conditions 4
Paths 3

Size

Total Lines 14
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 4
eloc 8
nc 3
nop 2
dl 0
loc 14
rs 9.2
c 0
b 0
f 0
1
<?php
2
namespace exussum12\CoverageChecker;
3
4
use XMLReader;
5
6
/**
7
 * Class PhpMdLoaderStrict
8
 * Used for parsing phpmd xml output
9
 * Strict mode reports errors multiple times
10
 * @package exussum12\CoverageChecker
11
 */
12
class PhpMdLoaderStrict extends PhpMdLoader
13
{
14
    public function getErrorsOnLine($file, $lineNumber)
15
    {
16
        $errors = [];
17
        foreach ($this->errorRanges[$file] as $error) {
18
            if ((
19
                $error['start'] <= $lineNumber &&
20
                $error['end'] >= $lineNumber
21
            )) {
22
                $errors[] = $error['error'];
23
            }
24
        }
25
26
        return $errors;
27
    }
28
29
    /**
30
     * {@inheritdoc}
31
     */
32
    public static function getDescription()
33
    {
34
        return 'Parses the xml report format of phpmd, this mode ' .
35
            'reports multi line violations once per line they occur ';
36
    }
37
}
38