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

ViolationParser   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 11

Importance

Changes 0
Metric Value
dl 0
loc 32
rs 10
c 0
b 0
f 0
wmc 3
lcom 0
cbo 11

1 Method

Rating   Name   Duplication   Size   Complexity  
B apply() 0 24 3
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