Completed
Push — master ( e1173d...cdf0e4 )
by Oskar
05:16 queued 03:02
created

ViolationParser::apply()   B

Complexity

Conditions 3
Paths 3

Size

Total Lines 24
Code Lines 15

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 3
eloc 15
nc 3
nop 1
dl 0
loc 24
rs 8.9713
c 0
b 0
f 0
1
<?php
2
namespace Hal\Violation;
3
4
use Hal\Metric\Metrics;
5
use Hal\Violation\Class_;
6
use Hal\Violation\Package;
7
8
class ViolationParser
9
{
10
11
    /**
12
     * @param Metrics $metrics
13
     * @return $this
14
     */
15
    public function apply(Metrics $metrics)
16
    {
17
18
        $violations = [
19
            new Class_\Blob(),
20
            new Class_\TooComplexClassCode(),
21
            new Class_\TooComplexMethodCode(),
22
            new Class_\ProbablyBugged(),
23
            new Class_\TooLong(),
24
            new Class_\TooDependent(),
25
            new Package\StableAbstractionsPrinciple(),
26
            new Package\StableDependenciesPrinciple(),
27
        ];
28
29
        foreach ($metrics->all() as $metric) {
30
            $metric->set('violations', new Violations);
31
32
            foreach ($violations as $violation) {
33
                $violation->apply($metric);
34
            }
35
        }
36
37
        return $this;
38
    }
39
}
40