DevBuildController   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 18
dl 0
loc 29
rs 10
c 0
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A build() 0 18 2
1
<?php
2
3
namespace SilverStripe\Dev;
4
5
use SilverStripe\Control\Controller;
6
use SilverStripe\Control\Director;
7
use SilverStripe\ORM\DatabaseAdmin;
8
9
class DevBuildController extends Controller
10
{
11
12
    private static $url_handlers = array(
0 ignored issues
show
introduced by
The private property $url_handlers is not used, and could be removed.
Loading history...
13
        '' => 'build'
14
    );
15
16
    private static $allowed_actions = array(
0 ignored issues
show
introduced by
The private property $allowed_actions is not used, and could be removed.
Loading history...
17
        'build'
18
    );
19
20
    public function build($request)
21
    {
22
        if (Director::is_cli()) {
23
            $da = DatabaseAdmin::create();
24
            return $da->handleRequest($request);
25
        } else {
26
            $renderer = DebugView::create();
27
            echo $renderer->renderHeader();
28
            echo $renderer->renderInfo("Environment Builder", Director::absoluteBaseURL());
29
            echo "<div class=\"build\">";
30
31
            $da = DatabaseAdmin::create();
32
            $response = $da->handleRequest($request);
33
34
            echo "</div>";
35
            echo $renderer->renderFooter();
36
37
            return $response;
38
        }
39
    }
40
}
41