• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

sineflow / clamav / 17156707618

22 Aug 2025 01:18PM UTC coverage: 76.106% (+1.1%) from 75.0%
17156707618

push

github

pmishev
Updated github actions

86 of 113 relevant lines covered (76.11%)

50.26 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

83.33
/src/DTO/ScannedFile.php
1
<?php
2

3
namespace Sineflow\ClamAV\DTO;
4

5
use Sineflow\ClamAV\Exception\FileScanException;
6

7
class ScannedFile
8
{
9
    /**
10
     * @var string
11
     */
12
    private $rawResponse;
13

14
    /**
15
     * @var string
16
     */
17
    private $fileName;
18

19
    /**
20
     * @var bool
21
     */
22
    private $isClean;
23

24
    /**
25
     * @var string
26
     */
27
    private $virusName;
28

29
    /**
30
     * @param string $rawResponse
31
     */
32
    public function __construct(string $rawResponse)
90✔
33
    {
34
        $isParsed = preg_match('/(.*):(.*)(FOUND|OK|ERROR)/i', $rawResponse, $matches);
90✔
35

36
        if (!$isParsed) {
90✔
37
            throw new \RuntimeException(sprintf('Failed to parse clamav response: %s', $rawResponse));
×
38
        }
39

40
        if ($matches[3] === 'ERROR') {
90✔
41
            throw new FileScanException($matches[1], trim($matches[2]));
18✔
42
        }
43

44
        $this->rawResponse = $rawResponse;
72✔
45
        $this->fileName = $matches[1];
72✔
46
        $this->virusName = trim($matches[2]);
72✔
47
        $this->isClean = ($matches[3] === 'OK');
72✔
48
    }
49

50
    /**
51
     * @return string
52
     */
53
    public function getRawResponse(): string
×
54
    {
55
        return $this->rawResponse;
×
56
    }
57

58
    /**
59
     * @return string
60
     */
61
    public function getFileName(): string
72✔
62
    {
63
        return $this->fileName;
72✔
64
    }
65

66
    /**
67
     * @return bool
68
     */
69
    public function isClean(): bool
72✔
70
    {
71
        return $this->isClean;
72✔
72
    }
73

74
    /**
75
     * @return string
76
     */
77
    public function getVirusName(): string
72✔
78
    {
79
        return $this->virusName;
72✔
80
    }
81
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc