Passed
Push — master ( 5575b8...aa594f )
by Satoshi
02:04
created

VerifyDependencyResponse::count()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
declare(strict_types=1);
3
4
namespace DependencyAnalyzer\Detector\Responses;
5
6
class VerifyDependencyResponse implements \Countable
7
{
8
    /**
9
     * @var string
10
     */
11
    private $ruleName;
12
13
    private $violations = [];
14
15
    public function __construct(string $ruleName)
16
    {
17
        $this->ruleName = $ruleName;
18
    }
19
20
    public function addRuleViolation(string $dependerComponent, string $depender, string $dependeeComponent, string $dependee)
21
    {
22
        $this->violations[] = [
23
            'dependerComponent' => $dependerComponent,
24
            'depender' => $depender,
25
            'dependeeComponent' => $dependeeComponent,
26
            'dependee' => $dependee
27
        ];
28
    }
29
30
    public function getRuleName()
31
    {
32
        return $this->ruleName;
33
    }
34
35
    public function getViolations(): array
36
    {
37
        return $this->violations;
38
        /**
39
         * Hoge component rule violations
40
         * | hoge.php | Hoge | -> | fuga.php | Fuga |
41
         * | hoge.php | Hoge | -> | fuga.php | Fuga |
42
         *
43
         * | No | file path |
44
         * |---|---|
45
         * | 1  | hoge.php |
46
         * | 2  | fuga.php |
47
         */
48
    }
49
50
    public function count()
51
    {
52
        return count($this->violations);
53
    }
54
}
55