Completed
Push — master ( 5ef5a6...726f17 )
by Jonathan
02:41
created

ChunkResults   A

Complexity

Total Complexity 12

Size/Duplication

Total Lines 82
Duplicated Lines 0 %

Coupling/Cohesion

Components 5
Dependencies 0

Test Coverage

Coverage 29.63%

Importance

Changes 0
Metric Value
wmc 12
lcom 5
cbo 0
dl 0
loc 82
ccs 8
cts 27
cp 0.2963
rs 10
c 0
b 0
f 0

11 Methods

Rating   Name   Duplication   Size   Complexity  
A incrementNumAssertions() 0 4 1
A getNumAssertions() 0 4 1
A incrementNumFailures() 0 4 1
A getNumFailures() 0 4 1
A incrementNumChunkFailures() 0 4 1
A getNumChunkFailures() 0 4 1
A incrementTotalTestsRan() 0 4 1
A getTotalTestsRan() 0 4 1
A addCode() 0 4 1
A getCodes() 0 4 1
A hasFailed() 0 4 2
1
<?php
2
3
declare(strict_types = 1);
4
5
namespace PHPChunkit;
6
7
class ChunkResults
8
{
9
    /**
10
     * @var integer
11
     */
12
    private $numAssertions = 0;
13
14
    /**
15
     * @var integer
16
     */
17
    private $numFailures = 0;
18
19
    /**
20
     * @var integer
21
     */
22
    private $numChunkFailures = 0;
23
24
    /**
25
     * @var integer
26
     */
27
    private $totalTestsRan = 0;
28
29
    /**
30
     * @var array
31
     */
32
    private $codes = [];
33
34
    public function incrementNumAssertions(int $num = 1)
35
    {
36
        $this->numAssertions += $num;
37
    }
38
39 1
    public function getNumAssertions() : int
40
    {
41 1
        return $this->numAssertions;
42
    }
43
44
    public function incrementNumFailures(int $num = 1)
45
    {
46
        $this->numFailures += $num;
47
    }
48
49 1
    public function getNumFailures() : int
50
    {
51 1
        return $this->numFailures;
52
    }
53
54
    public function incrementNumChunkFailures(int $num = 1)
55
    {
56
        $this->numChunkFailures += $num;
57
    }
58
59
    public function getNumChunkFailures() : int
60
    {
61
        return $this->numChunkFailures;
62
    }
63
64
    public function incrementTotalTestsRan(int $num = 1)
65
    {
66
        $this->totalTestsRan += $num;
67
    }
68
69 1
    public function getTotalTestsRan() : int
70
    {
71 1
        return $this->totalTestsRan;
72
    }
73
74
    public function addCode(int $code)
75
    {
76
        $this->codes[] = $code;
77
    }
78
79
    public function getCodes() : array
80
    {
81
        return $this->codes;
82
    }
83
84 1
    public function hasFailed() : bool
85
    {
86 1
        return array_sum($this->codes) ? true : false;
87
    }
88
}
89