Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
4 / 4
CRAP
100.00% covered (success)
100.00%
1 / 1
ScanResult
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
4 / 4
4
100.00% covered (success)
100.00%
1 / 1
 __construct
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 isInfected
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getVirusName
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getOriginalResponse
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3/**
4 * SPDX-License-Identifier: EUPL-1.2
5 *
6 * This file is part of icap-flow.
7 *
8 * Licensed under the EUPL, Version 1.2 only (the "Licence");
9 * you may not use this work except in compliance with the Licence.
10 * You may obtain a copy of the Licence at:
11 *
12 *     https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
13 *
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the Licence is distributed on an "AS IS" basis,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 */
18
19declare(strict_types=1);
20
21namespace Ndrstmr\Icap\DTO;
22
23/**
24 * Result object returned after scanning content via ICAP.
25 */
26final readonly class ScanResult
27{
28    public function __construct(
29        private bool $isInfected,
30        private ?string $virusName,
31        private IcapResponse $originalResponse,
32    ) {
33    }
34
35    /**
36     * Whether the scanned content was infected.
37     */
38    public function isInfected(): bool
39    {
40        return $this->isInfected;
41    }
42
43    /**
44     * Name of the detected virus, if any.
45     */
46    public function getVirusName(): ?string
47    {
48        return $this->virusName;
49    }
50
51    /**
52     * Access to the original ICAP response for advanced use.
53     */
54    public function getOriginalResponse(): IcapResponse
55    {
56        return $this->originalResponse;
57    }
58}