DevCheckController   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 11
dl 0
loc 36
rs 10
c 0
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A index() 0 13 2
1
<?php
2
3
namespace SilverStripe\EnvironmentCheck\Controllers;
4
5
use SilverStripe\Control\Controller;
6
use SilverStripe\Control\HTTPRequest;
7
use SilverStripe\Control\HTTPResponse_Exception;
8
use SilverStripe\EnvironmentCheck\EnvironmentChecker;
9
10
/**
11
 * Class DevCheckController
12
 *
13
 * @package environmentcheck
14
 */
15
class DevCheckController extends Controller
16
{
17
    /**
18
     * @var array
19
     */
20
    private static $allowed_actions = [
0 ignored issues
show
introduced by
The private property $allowed_actions is not used, and could be removed.
Loading history...
21
        'index'
22
    ];
23
24
    /**
25
     * Permission code to check for access to this controller.
26
     *
27
     * @var string
28
     */
29
    private static $permission = 'ADMIN';
30
31
    /**
32
     * @param HTTPRequest $request
33
     *
34
     * @return EnvironmentChecker
35
     *
36
     * @throws HTTPResponse_Exception
37
     */
38
    public function index($request)
39
    {
40
        $suite = 'check';
41
42
        if ($name = $request->param('Suite')) {
43
            $suite = $name;
44
        }
45
46
        $checker = new EnvironmentChecker($suite, 'Environment status');
47
        $checker->setRequest($request);
48
        $checker->init($this->config()->permission);
49
50
        return $checker;
51
    }
52
}
53