SelfTestSuhosin   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
c 1
b 0
f 0
lcom 1
cbo 1
dl 0
loc 32
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A doTest() 0 14 2
A isSuhosinLoaded() 0 4 1
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