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
Pull Request — master (#17)
by TJ
04:32
created

LogHandler::write()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 25

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 25
rs 9.52
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
namespace Honeybadger\HoneybadgerLaravel;
4
5
use Monolog\Logger;
6
use Honeybadger\Contracts\Reporter;
7
use Monolog\Formatter\LineFormatter;
8
use Monolog\Formatter\FormatterInterface;
9
use Monolog\Handler\AbstractProcessingHandler;
10
11
class LogHandler extends AbstractProcessingHandler
12
{
13
    /**
14
     * @var \Honeybadger\Contracts\Reporter
15
     */
16
    protected $honeybadger;
17
18
    /**
19
     * @param  \Honeybadger\Contracts\Reporter  $honeybadger
20
     * @param  int  $level
21
     * @param  bool  $bubble
22
     */
23
    public function __construct(Reporter $honeybadger, int $level = Logger::DEBUG, bool $bubble = true)
24
    {
25
        parent::__construct($level, $bubble);
26
27
        $this->honeybadger = $honeybadger;
28
    }
29
30
    /**
31
     * {@inheritdoc}
32
     */
33
    protected function write(array $record)
34
    {
35
        $this->honeybadger->rawNotification(function ($config) use ($record) {
0 ignored issues
show
Bug introduced by
The method rawNotification() does not seem to exist on object<Honeybadger\Contracts\Reporter>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
36
            return [
37
                'notifier' => array_merge($config['notifier'], ['name' => 'Honeybadger Log Handler']),
38
                'error' => [
39
                    'class' => $record['message'],
40
                    'message' => $record['formatted'],
41
                    'tags' => [
42
                        'log',
43
                        sprintf('%s.%s', $record['channel'], $record['level_name']),
44
                    ],
45
                    'fingerprint' => md5($record['formatted']),
46
                ],
47
                'request' => [
48
                    'context' => [
49
                        'context' => $record['context'],
50
                        'level_name' => $record['level_name'],
51
                        'log_channel' => $record['channel'],
52
                        'message' => $record['message'],
53
                    ],
54
                ],
55
            ];
56
        });
57
    }
58
59
    /**
60
     * {@inheritdoc}
61
     */
62
    public function getFormatter() : FormatterInterface
63
    {
64
        return new LineFormatter('[%datetime%] %channel%.%level_name%: %message%');
65
    }
66
}
67