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

PhpMdLoaderStrict   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 26
rs 10
c 1
b 0
f 0
wmc 5
lcom 1
cbo 1

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getErrorsOnLine() 0 14 4
A getDescription() 0 5 1
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