fucongcong/framework

View on GitHub
core/Group/Handlers/ExceptionsHandler.php

Summary

Maintainability
A
1 hr
Test Coverage

Showing 27 of 27 total issues

Method handleError has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

public function handleError($level, $message, $file = '', $line = 0, $context = [])
Severity: Minor
Found in core/Group/Handlers/ExceptionsHandler.php - About 35 mins to fix

    Function handleShutdown has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    public function handleShutdown()
    {
    if ($e = error_get_last()) {
    if ($this->isFatal($e['type'])) {
    $this->record($e);
    Severity: Minor
    Found in core/Group/Handlers/ExceptionsHandler.php - About 35 mins to fix

    Function handleError has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    public function handleError($level, $message, $file = '', $line = 0, $context = [])
    {
    if (error_reporting() & $level) {
    $error = [
    'message' => $message,
    Severity: Minor
    Found in core/Group/Handlers/ExceptionsHandler.php - About 35 mins to fix

    Avoid using undefined variables such as '$e' which will lead to PHP notices.
    Open

    $this->renderHttpResponse($e);

    Avoid using undefined variables such as '$error' which will lead to PHP notices.
    Open

    $error['message'] = $e;

    Avoid using undefined variables such as '$e' which will lead to PHP notices.
    Open

    $this->renderForConsole($e);

    Avoid using undefined variables such as '$error' which will lead to PHP notices.
    Open

    $e = $error;

    Avoid using undefined variables such as '$error' which will lead to PHP notices.
    Open

    $error['file'] = $trace[0]['file'];

    Avoid using undefined variables such as '$error' which will lead to PHP notices.
    Open

    $error['line'] = $trace[0]['line'];

    Missing class import via use statement (line '128', column '31').
    Open

    $controller = new \Controller($this->app);

    The method renderHttpResponse uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
    Open

    }else {
    if (!is_array($e)) {
    $trace = debug_backtrace();
    $error['message'] = $e;
    $error['file'] = $trace[0]['file'];

    The method handleShutdown uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
    Open

    } else {
    $this->renderHttpResponse($e);
    }

    The method handleError uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
    Open

    } else {
    $this->renderHttpResponse($e);
    }

    The method handleException uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
    Open

    } else {
    $this->renderHttpResponse($error);
    }

    Avoid assigning values to variables in if clauses and the like (line '153', column '13').
    Open

    public function handleShutdown()
    {
    if ($e = error_get_last()) {
    if ($this->isFatal($e['type'])) {
    $this->record($e);

    Avoid unused parameters such as '$e'.
    Open

    protected function renderForConsole($e)

    Avoid unused parameters such as '$context'.
    Open

    public function handleError($level, $message, $file = '', $line = 0, $context = [])

    Avoid variables with short names like $e. Configured minimum length is 3.
    Open

    public function handleException($e)

    Avoid variables with short names like $e. Configured minimum length is 3.
    Open

    protected function renderHttpResponse($e)

    Avoid variables with short names like $e. Configured minimum length is 3.
    Open

    if ($e = error_get_last()) {

    Avoid variables with short names like $e. Configured minimum length is 3.
    Open

    protected function renderForConsole($e)

    Avoid variables with short names like $e. Configured minimum length is 3.
    Open

    protected function record($e, $type = 'error')

    The closing brace for the class must go on the next line after the body
    Open

    }

    Function closing brace must go on the next line following the body; found 1 blank lines before brace
    Open

    }

    Blank line found at end of control structure
    Open

    Line exceeds 120 characters; contains 126 characters
    Open

    \Log::$type('[' . $this->levels[$e['type']] . '] ' . $e['message'] . '[' . $e['file'] . ' : ' . $e['line'] . ']', []);

    Expected 1 space after closing brace; 0 found
    Open

    }else {

    There are no issues that match your filters.

    Category
    Status