Passed
Push — master ( 7f6baf...50f068 )
by Satoshi
02:16
created

RuleViolationDetector   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 7
dl 0
loc 27
rs 10
c 0
b 0
f 0
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A inspect() 0 8 2
1
<?php
2
namespace DependencyAnalyzer\Inspector;
3
4
use DependencyAnalyzer\Inspector\RuleViolationDetector\DependencyRule;
5
use DependencyAnalyzer\DependencyGraph;
6
use DependencyAnalyzer\Inspector\Responses\VerifyDependencyResponse;
7
8
class RuleViolationDetector
9
{
10
    /**
11
     * @var DependencyRule[]
12
     */
13
    protected $rules;
14
15
    /**
16
     * @param DependencyRule[] $rules
17
     */
18
    public function __construct(array $rules = [])
19
    {
20
        $this->rules = $rules;
21
    }
22
23
    /**
24
     * @param DependencyGraph $graph
25
     * @return VerifyDependencyResponse[]
26
     */
27
    public function inspect(DependencyGraph $graph): array
28
    {
29
        $verifyDependencyResponses = [];
30
        foreach ($this->rules as $rule) {
31
            $verifyDependencyResponses[] = $rule->isSatisfyBy($graph);
32
        }
33
34
        return $verifyDependencyResponses;
35
    }
36
}
37