PhpMdStrict::getErrorsOnLine()   A
last analyzed

Complexity

Conditions 4
Paths 3

Size

Total Lines 13
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

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