Code Duplication    Length = 10-10 lines in 2 locations

lib/TestCase/Cert.php 1 location

@@ 111-120 (lines=10) @@
108
        $testResult = new TestResult($this->getCategory(), $this->getSubject());
109
        $threshold = $moduleConfig->getValue('certExpirationWarning', 28);
110
111
        if ($expiration < 0) {
112
            $testResult->setState(State::ERROR);
113
            $testResult->setMessage('Certificate has expired ' . $daysStr . ' ago');
114
        } else if ($expiration <= $threshold) {
115
            $testResult->setState(State::WARNING);
116
            $testResult->setMessage('Certificate will expire in ' . $daysStr);
117
        } else {
118
            $testResult->setState(State::OK);
119
            $testResult->setMessage('Certificate valid for another ' . $daysStr);
120
        }
121
122
        $testResult->addOutput($expiration, 'expiration');
123
        $this->setTestResult($testResult);

lib/TestCase/FileSystem/FreeSpace.php 1 location

@@ 58-67 (lines=10) @@
55
        $used = $size - disk_free_space($path);
56
        $free = round(100 - (($used / $size) * 100));
57
58
        if ($free >= 15) {
59
            $testResult->setMessage($free . '% free space');
60
            $testResult->setState(State::OK);
61
        } else if ($free < 5) {
62
            $testResult->setMessage('Critical: ' . $free . '% free space');
63
            $testResult->setState(State::ERROR);
64
        } else {
65
            $testResult->setMessage($free . '% free space');
66
            $testResult->setState(State::WARNING);
67
        }
68
69
        $testResult->addOutput($free, 'free_percentage');
70
        $this->setTestResult($testResult);