RunResult   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Importance

Changes 4
Bugs 0 Features 0
Metric Value
eloc 12
c 4
b 0
f 0
dl 0
loc 40
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getResults() 0 3 1
A getStatus() 0 3 1
A addResult() 0 11 1
1
<?php
2
3
namespace Leankoala\HealthFoundation;
4
5
use Leankoala\HealthFoundation\Check\Check;
6
use Leankoala\HealthFoundation\Check\Result;
7
8
class RunResult
9
{
10
    /**
11
     * @var Result[]
12
     */
13
    private $singleResults = [];
14
15
    private $globalStatus = Result::STATUS_PASS;
16
17
    /**
18
     * @param Check $check
19
     * @param Result $result
20
     * @param false $identifier
21
     * @param string $description
22
     * @param string $group
23
     */
24
    public function addResult(Check $check, Result $result, $identifier = false, $description = "", $group = "")
25
    {
26
        $this->singleResults[] = [
27
            'check' => $check,
28
            'result' => $result,
29
            'identifier' => $identifier,
30
            'description' => $description,
31
            'group' => $group
32
        ];
33
34
        $this->globalStatus = Result::getHigherWeightedStatus($this->globalStatus, $result->getStatus());
35
    }
36
37
    /**
38
     * @return array
39
     */
40
    public function getResults(): array
41
    {
42
        return $this->singleResults;
43
    }
44
45
    public function getStatus()
46
    {
47
        return $this->globalStatus;
48
    }
49
}
50