SelfTestSuhosin::isSuhosinLoaded()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
/**
4
 * This file is part of tenside/core.
5
 *
6
 * (c) Christian Schiffler <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 *
11
 * This project is provided in good faith and hope to be usable by anyone.
12
 *
13
 * @package    tenside/core
14
 * @author     Christian Schiffler <[email protected]>
15
 * @copyright  2015 Christian Schiffler <[email protected]>
16
 * @license    https://github.com/tenside/core/blob/master/LICENSE MIT
17
 * @link       https://github.com/tenside/core
18
 * @filesource
19
 */
20
21
namespace Tenside\Core\SelfTest\Php;
22
23
use Tenside\Core\SelfTest\AbstractSelfTest;
24
25
/**
26
 * This class tests the current environment for correctly configured suhosin extension is suitable for running tenside.
27
 */
28
class SelfTestSuhosin extends AbstractSelfTest
29
{
30
    /**
31
     * Check that Suhosin is correctly configured.
32
     *
33
     * @return void
34
     */
35
    public function doTest()
36
    {
37
        $this->setMessage('Check if Suhosin is either not loaded or correctly configured.');
38
39
        if (!$this->isSuhosinLoaded()) {
40
            $this->markSuccess();
41
            return;
42
        }
43
44
        $this->markFailed(
45
            'The php extension suhosin is loaded. ' .
46
            'This extension has been known to create problems in the past, consider deactivating it.'
47
        );
48
    }
49
50
    /**
51
     * Check if Suhosin is loaded.
52
     *
53
     * @return bool
54
     */
55
    private function isSuhosinLoaded()
56
    {
57
        return extension_loaded('suhosin');
58
    }
59
}
60