Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
4 / 4 |
|
100.00% |
4 / 4 |
CRAP | |
100.00% |
1 / 1 |
ScanResult | |
100.00% |
4 / 4 |
|
100.00% |
4 / 4 |
4 | |
100.00% |
1 / 1 |
__construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
isInfected | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getVirusName | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getOriginalResponse | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 |
1 | <?php |
2 | |
3 | declare(strict_types=1); |
4 | |
5 | namespace Ndrstmr\Icap\DTO; |
6 | |
7 | /** |
8 | * Result object returned after scanning content via ICAP. |
9 | */ |
10 | final readonly class ScanResult |
11 | { |
12 | public function __construct( |
13 | private bool $isInfected, |
14 | private ?string $virusName, |
15 | private IcapResponse $originalResponse, |
16 | ) { |
17 | } |
18 | |
19 | /** |
20 | * Whether the scanned content was infected. |
21 | */ |
22 | public function isInfected(): bool |
23 | { |
24 | return $this->isInfected; |
25 | } |
26 | |
27 | /** |
28 | * Name of the detected virus, if any. |
29 | */ |
30 | public function getVirusName(): ?string |
31 | { |
32 | return $this->virusName; |
33 | } |
34 | |
35 | /** |
36 | * Access to the original ICAP response for advanced use. |
37 | */ |
38 | public function getOriginalResponse(): IcapResponse |
39 | { |
40 | return $this->originalResponse; |
41 | } |
42 | } |