Issues (148)

src/Application/Helper/Error.php (1 issue)

1
<?php
2
3
/**
4
 * Bluz Framework Component
5
 *
6
 * @copyright Bluz PHP Team
7
 * @link      https://github.com/bluzphp/framework
8
 */
9
10
declare(strict_types=1);
11
12
namespace Bluz\Application\Helper;
13
14
use Bluz\Application\Application;
15
use Bluz\Common\Exception\CommonException;
16
use Bluz\Common\Exception\ComponentException;
17
use Bluz\Controller\Controller;
18
use Bluz\Controller\ControllerException;
19
use Bluz\Proxy\Response;
20
use Bluz\Proxy\Router;
21
use Exception;
22
use ReflectionException;
23
24
/**
25
 * Reload helper can be declared inside Bootstrap
26
 *
27
 * @param Exception $exception
28
 *
29
 * @return Controller
30
 * @throws CommonException
31
 * @throws ComponentException
32
 * @throws ControllerException
33
 * @throws ReflectionException
34
 */
35
return
36 1
    function (Exception $exception) {
37
        /**
38
         * @var Application $this
39
         */
40 3
        Response::removeHeaders();
41 3
        Response::clearBody();
42
43 3
        $module = Router::getErrorModule();
44 3
        $controller = Router::getErrorController();
45 3
        $params = ['code' => $exception->getCode(), 'exception' => $exception];
46
47 3
        return $this->dispatch($module, $controller, $params);
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $this seems to be never defined.
Loading history...
48
    };
49