GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — 3.0 ( de1771...791612 )
by Vermeulen
04:28
created

ErrorsDisplay::defaultCliErrorRender()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 21
Code Lines 14

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 21
rs 9.3142
cc 1
eloc 14
nc 1
nop 5
1
<?php
2
3
namespace BFW\Core;
4
5
class ErrorsDisplay
6
{
7
    /**
8
     * The default cli render in BFW
9
     * 
10
     * @param string  $errType : Human readable error severity
11
     * @param string  $errMsg : Error/exception message
12
     * @param string  $errFile : File where the error/exception is triggered
13
     * @param integer $errLine : Line where the error/exception is triggered
14
     * @param array   $backtrace : Error/exception backtrace
15
     * 
16
     * @return void
17
     */
18
    public static function defaultCliErrorRender(
19
        $errType,
20
        $errMsg,
21
        $errFile,
22
        $errLine,
23
        $backtrace
0 ignored issues
show
Unused Code introduced by
The parameter $backtrace is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
24
    ) {
25
        //Create the cli message
26
        $msgError = $errType.' Error : '.$errMsg.
27
            ' in '.$errFile.' at line '.$errLine;
28
        
29
        //Display the message with displayMsg function
30
        \BFW\Helpers\Cli::displayMsg(
31
            $msgError,
32
            'white',
33
            'red'
34
        );
35
        
36
        ob_flush();
37
        exit;
38
    }
39
40
    /**
41
     * The default error render in BFW
42
     * 
43
     * @param string  $errType : Human readable error severity
44
     * @param string  $errMsg : Error/exception message
45
     * @param string  $errFile : File where the error/exception is triggered
46
     * @param integer $errLine : Line where the error/exception is triggered
47
     * @param array   $backtrace : Error/exception backtrace
48
     * 
49
     * @return void
50
     */
51
    public static function defaultErrorRender(
52
        $errType,
53
        $errMsg,
54
        $errFile,
55
        $errLine,
56
        $backtrace
57
    ) {
58
        http_response_code(500);
59
        ob_clean();
60
61
        echo '
62
        <!doctype html>
63
        <html lang="fr">
64
            <head>
65
                <title>An error is detected !</title>
66
                <style>
67
                    html {padding:0; margin:0; background-color:#e3e3e3; font-family:sans-serif; font-size: 1em; word-wrap:break-word;}
68
                    div {position:relative; margin:auto; width:950px; border: 1px solid #a6c9e2; top: 30px; margin-bottom:10px;}
69
                    p {padding:0; margin:0;}
70
                    p.title {font-size:1.2em; background-color:#D0DCE9; padding:10px;}
71
                    p.info {padding:5px; margin-top:10px; margin-bottom:10px;}
72
                    fieldset {border:none; background-color: white;}
73
                    pre {width:910px; line-height:1.5;}
74
                </style>
75
            </head>
76
            <body>
77
                <div>
78
                    <p class="title">Niarf, an error is detected !</p>
79
                    <p class="info">'.$errType.' Error : <strong>'.$errMsg.'</strong> in '.$errFile.' at line '.$errLine.'</p>
80
                    <fieldset><pre>';
81
                        foreach ($backtrace as $i => $info) {
82
                            echo '#'.$i.'  '.$info['function'];
83
84
                            if (isset($info['args']) && count($info['args']) > 0) {
85
                                echo '(';
86
87
                                foreach ($info['args'] as $iArgs => $args) {
88
                                    if ($iArgs > 0) {
89
                                        echo ', ';
90
                                    }
91
92
                                    if (is_array($args) || is_object($args)) {
93
                                        echo gettype($args);
94
                                    } elseif (is_null($args)) {
95
                                        echo 'null';
96
                                    } else {
97
                                        echo htmlentities($args);
98
                                    }
99
                                }
100
101
                                echo ')';
102
                            }
103
104
                            if (isset($info['file'], $info['line'])) {
105
                                echo ' called at ['.$info['file'].' line '.$info['line'].']';
106
                            }
107
                            echo "\n\n";
108
                        }
109
                    echo '</pre></fieldset>
110
                </div>
111
            <body>
112
        </html>
113
        ';
114
115
        ob_flush();
116
        exit;
117
    }
118
}
119