Passed
Push — master ( 5b5ed9...47b84a )
by Alex
02:17
created

AjaxApplication.php (1 issue)

Labels
Severity
1
<?php
2
namespace Mezon\Application;
3
4
/**
5
 * Class AjaxApplication
6
 *
7
 * @package Application
8
 * @subpackage AjaxApplication
9
 * @author Dodonov A.A.
10
 * @version v.1.0 (2019/09/27)
11
 * @copyright Copyright (c) 2019, aeon.org
12
 */
13
14
/**
15
 * Base class of the ajax-application
16
 */
17
abstract class AjaxApplication extends \Mezon\Application\Application
18
{
19
20
    use \Mezon\Application\AjaxMethodsTrait;
21
22
    /**
23
     * Method processes exception.
24
     *
25
     * @param \Exception $e
26
     *            Exception object.
27
     */
28
    public function handleException(\Exception $e): void
29
    {
30
        $error = new \stdClass();
31
        $error->message = $e->getMessage();
32
        $error->code = $e->getCode();
33
        if (isset($e->HTTPBody)) {
34
            $error->httpBody = $e->HTTPBody;
35
        }
36
        $error->call_stack = $this->formatCallStack($e);
0 ignored issues
show
The method formatCallStack() does not exist on Mezon\Application\AjaxApplication. Since you implemented __call, consider adding a @method annotation. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

36
        /** @scrutinizer ignore-call */ 
37
        $error->call_stack = $this->formatCallStack($e);
Loading history...
37
        $error->host = $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
38
39
        print(json_encode($error, JSON_PRETTY_PRINT));
40
    }
41
}
42