Completed
Branch master (9dcfc4)
by Daniel
24:32
created

DevCheckController   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 2
dl 0
loc 37
rs 10
c 0
b 0
f 0

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\EnvironmentCheck\EnvironmentChecker;
7
8
/**
9
 * Class DevCheckController
10
 *
11
 * @package environmentcheck
12
 */
13
class DevCheckController extends Controller
14
{
15
    /**
16
     * @var array
17
     */
18
    private static $allowed_actions = [
0 ignored issues
show
Comprehensibility introduced by
Consider using a different property name as you override a private property of the parent class.
Loading history...
Unused Code introduced by
The property $allowed_actions is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
19
        'index'
20
    ];
21
22
    /**
23
     * Permission code to check for access to this controller.
24
     *
25
     * @var string
26
     */
27
    private static $permission = 'ADMIN';
0 ignored issues
show
Unused Code introduced by
The property $permission is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
28
29
    /**
30
     * @param HTTPRequest $request
31
     *
32
     * @return EnvironmentChecker
33
     *
34
     * @throws HTTPResponse_Exception
35
     */
36
    public function index($request)
37
    {
38
        $suite = 'check';
39
40
        if ($name = $request->param('Suite')) {
41
            $suite = $name;
42
        }
43
44
        $checker = new EnvironmentChecker($suite, 'Environment status');
45
        $checker->init($this->config()->permission);
46
47
        return $checker;
48
    }
49
}
50