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.

ErrorHandler::handle()   A
last analyzed

Complexity

Conditions 3
Paths 3

Size

Total Lines 12
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 3
Bugs 0 Features 0
Metric Value
cc 3
eloc 6
c 3
b 0
f 0
nc 3
nop 4
dl 0
loc 12
rs 10
1
<?php
2
3
namespace Honeybadger\Handlers;
4
5
use ErrorException;
6
use Honeybadger\Contracts\Handler as HandlerContract;
7
8
class ErrorHandler extends Handler implements HandlerContract
9
{
10
    /**
11
     * @var callable
12
     */
13
    protected $previousHandler;
14
15
    /**
16
     * @return void
17
     */
18
    public function register(): void
19
    {
20
        $this->previousHandler = set_error_handler([$this, 'handle']);
21
    }
22
23
    /**
24
     * @param  int  $code
25
     * @param  string  $error
26
     * @param  string  $file
27
     * @param  int  $line
28
     * @return mixed
29
     *
30
     * @throws \Honeyhadger\Exceptions\ServiceException
31
     */
32
    public function handle($code, $error, $file = null, $line = null)
33
    {
34
        if (error_reporting() === 0) {
35
            return false;
36
        }
37
38
        $this->honeybadger->notify(
39
            new ErrorException($error, 0, $code, $file, $line)
40
        );
41
42
        if (is_callable($this->previousHandler)) {
43
            call_user_func($this->previousHandler, $code, $error, $file, $line);
44
        }
45
    }
46
}
47