ProcessedFieldReport   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Test Coverage

Coverage 62.5%

Importance

Changes 0
Metric Value
eloc 15
dl 0
loc 45
ccs 10
cts 16
cp 0.625
rs 10
c 0
b 0
f 0
wmc 6

6 Methods

Rating   Name   Duplication   Size   Complexity  
A sanitizedInputValue() 0 3 1
A updateSuccessful() 0 3 1
A toArray() 0 6 1
A updateAttempted() 0 3 1
A voided() 0 3 1
A __construct() 0 8 1
1
<?php
2
3
namespace WebTheory\Saveyour\Report;
4
5
use WebTheory\Saveyour\Contracts\Report\ProcessedFieldReportInterface;
6
7
class ProcessedFieldReport implements ProcessedFieldReportInterface
8
{
9
    protected $sanitizedInputValue;
10
11
    protected bool $updateAttempted = false;
12
13
    protected bool $updateSuccessful = false;
14
15 45
    public function __construct(
16
        $sanitizedInputValue = null,
17
        bool $updateAttempted = false,
18
        bool $updateSuccessful = false
19
    ) {
20 45
        $this->sanitizedInputValue = $sanitizedInputValue;
21 45
        $this->updateAttempted = $updateAttempted;
22 45
        $this->updateSuccessful = $updateSuccessful;
23
    }
24
25 9
    public function sanitizedInputValue()
26
    {
27 9
        return $this->sanitizedInputValue;
28
    }
29
30 9
    public function updateAttempted(): bool
31
    {
32 9
        return $this->updateAttempted;
33
    }
34
35 9
    public function updateSuccessful(): bool
36
    {
37 9
        return $this->updateSuccessful;
38
    }
39
40
    public function toArray()
41
    {
42
        return [
43
            'sanitized_input_value' => $this->sanitizedInputValue,
44
            'update_attempted' => $this->updateAttempted,
45
            'update_successful' => $this->updateSuccessful,
46
        ];
47
    }
48
49
    public static function voided(): ProcessedFieldReportInterface
50
    {
51
        return new static(null, false, false);
52
    }
53
}
54