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
|
|
|
|