Completed
Push — master ( a1282a...4b88d6 )
by Matthew
02:10
created

arException   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 63
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0
Metric Value
wmc 6
lcom 1
cbo 0
dl 0
loc 63
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
B renderHTML() 0 56 5
A renderBanner() 0 4 1
1
<?php
2
3
class arException extends exception {
4
    public function renderHTML() {
5
        echo <<<END
6
<HTML>
7
<HEAD>
8
<TITLE>{$this->getMessage()}</TITLE>
9
<meta charset="UTF-8">
10
<meta http-equiv="X-UA-Compatible" content="IE=edge">
11
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
12
<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet" integrity="sha256-MfvZlkHCEqatNoGiOXveE8FIwMzZg4W85qfrfIFBfYc= sha512-dTfge/zgoMYpP7QbHy4gWMEGsbsdZeCXz7irItjcC3sPUFtf0kuFbDz/ixG7ArTxmDjLXDmezHubeNikyKGVyQ==" crossorigin="anonymous">
13
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">
14
<link href="awesome-bootstrap-checkbox/awesome-bootstrap-checkbox.css" rel="stylesheet">
15
    <style type="text/css">
16
      body {
17
        padding-top: 60px;
18
        padding-bottom: 40px;
19
      }
20
      </style>
21
<BODY>
22
23
<div class="container-fluid">
24
  <div class="row">
25
    <div class="col-md-10 col-md-offset-1">
26
      <div class="row marketing">
27
      <div class="col-md-12">
28
END;
29
        $this->renderBanner();
30
        if ($GLOBALS["role"] == "staging" || $GLOBALS["role"]== "test" || $GLOBALS["role"] == "autotest") {
31
            echo "<pre>";
32
            echo $this->getTraceAsString();
33
            echo "</pre>";
34
        }
35
        $url = "https://phabricator.wikimedia.org/maniphest/task/create/";
36
        $urlTitle = urlencode("{$this->getMessage()}");
37
        $urlAssigned = urlencode("matthewrbowker");
38
        $urlPriority = urlencode("25");
39
        $urlProject = urlencode("Tool-labs-tools-article-request");
40
        $urlDescription = urlencode("An error occured in Article Request: Line {$this->getLine()}: {$this->getMessage()}\r\n\r\n```\r\n{$this->getTraceAsString()}\r\n```");
41
        echo <<<END
42
        If you continue seeing this error, please
43
        <a href='$url?title=$urlTitle&assign=$urlAssigned&priority=$urlPriority&projects=$urlProject&description=$urlDescription' target=_blank>Report it to Phabricator</a>
44
        (requires a phabricator account).
45
      </div>
46
    </div>
47
48
    </div> <!-- /col-md-10 -->
49
50
    </div>
51
52
    </div> <!-- /container -->
53
</BODY>
54
</HTML>
55
END;
56
        if ($GLOBALS["role"] != "autotest") {die(1);}
57
        else {die(0);}
58
59
    }
60
61
    public function renderBanner() {
62
        echo "<div class=\"alert alert-danger\">\r\nLine {$this->getLine()} - {$this->getMessage()}</div>";
63
64
    }
65
}