Completed
Push — master ( cd9b92...5d1a48 )
by Tristan
02:54
created

GenericReport   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 51
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 1

Importance

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

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getMessage() 0 4 1
A hasDetails() 0 4 1
A getDetails() 0 4 1
1
<?php
2
3
namespace Enzyme\Axiom\Reports;
4
5
use Enzyme\Axiom\Atoms\StringAtom;
6
7
class GenericReport implements ReportInterface
8
{
9
    /**
10
     * The human readable message describing this report.
11
     * @var StringAtom
12
     */
13
    protected $message;
14
15
    /**
16
     * The optional details associated with this report.
17
     * @var array
18
     */
19
    protected $details;
20
21
    /**
22
     * Create a new generic report given the message and optional
23
     * details associated with it.
24
     *
25
     * @param StringAtom $message
26
     * @param array      $details
27
     */
28
    public function __construct(StringAtom $message, array $details = [])
29
    {
30
        $this->message = $message;
31
        $this->details = $details;
32
    }
33
34
    /**
35
     * @see ReportInterface
36
     */
37
    public function getMessage()
38
    {
39
        return $this->message->getValue();
40
    }
41
42
    /**
43
     * @see ReportInterface
44
     */
45
    public function hasDetails()
46
    {
47
        return count($this->details) > 0;
48
    }
49
50
    /**
51
     * @see ReportInterface
52
     */
53
    public function getDetails()
54
    {
55
        return $this->details;
56
    }
57
}
58