Report   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 46
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 3
Bugs 0 Features 0
Metric Value
wmc 4
c 3
b 0
f 0
lcom 1
cbo 0
dl 0
loc 46
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A __toString() 0 4 1
A formatRuleTags() 0 4 1
A getImpact() 0 4 1
1
<?php
2
3
namespace Ionut\Sylar\Filters\PHPIDS;
4
5
6
use Ionut\Sylar\Filters\FilterReportInterface;
7
use Ionut\Sylar\NormalizedValueVariant;
8
9
class Report implements FilterReportInterface
10
{
11
    /**
12
     * @var \stdClass
13
     */
14
    protected $rule;
15
16
    /**
17
     * @var NormalizedValueVariant
18
     */
19
    protected $value;
20
21
    /**
22
     * @param  \stdClass              $rule
23
     * @param  NormalizedValueVariant $value
24
     */
25
    public function __construct(\stdClass $rule, NormalizedValueVariant $value)
26
    {
27
        $this->rule = $rule;
28
        $this->value = $value;
29
    }
30
31
    /**
32
     * @return string
33
     */
34
    public function __toString()
35
    {
36
        return "{$this->formatRuleTags()} RULE{$this->rule->id} \"{$this->rule->description}\"";
37
    }
38
39
    /**
40
     * @return string
41
     */
42
    protected function formatRuleTags()
43
    {
44
        return strtoupper(implode(', ', $this->rule->tags->tag));
45
    }
46
47
    /**
48
     * @return int
49
     */
50
    public function getImpact()
51
    {
52
        return $this->rule->impact;
53
    }
54
}