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.

ErrorLogSubscriber::getSubscribedEvents()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1.125

Importance

Changes 0
Metric Value
dl 0
loc 6
ccs 3
cts 6
cp 0.5
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 1.125
1
<?php
2
3
namespace Bernard\EventListener;
4
5
use Bernard\Event\RejectEnvelopeEvent;
6
use Bernard\Envelope;
7
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
8
use Exception;
9
use Throwable;
10
11
class ErrorLogSubscriber implements EventSubscriberInterface
12
{
13
    /**
14
     * @param RejectEnvelopeEvent $event
15
     */
16 2
    public function onReject(RejectEnvelopeEvent $event)
17
    {
18 2
        error_log($this->format($event->getEnvelope(), $event->getException()));
19 2
    }
20
21
    /**
22
     * @param Envelope $envelope
23
     * @param mixed    $exception
24
     *
25
     * @return string
26
     */
27 2
    protected function format(Envelope $envelope, $exception)
28
    {
29 2
        if ($exception instanceof Exception || $exception instanceof Throwable) {
0 ignored issues
show
Bug introduced by
The class Throwable does not exist. Is this class maybe located in a folder that is not analyzed, or in a newer version of your dependencies than listed in your composer.lock/composer.json?
Loading history...
30
            $replacements = [
31 1
                '{class}' => get_class($exception),
32 1
                '{message}' => $exception->getMessage(),
33 1
                '{envelope}' => $envelope->getName(),
34 1
            ];
35
36 1
            return strtr('[bernard] caught exception {class}::{message} while processing {envelope}.', $replacements);
37
        }
38
39
        $replacements = [
40 1
            '{type}' => is_object($exception) ? get_class($exception) : gettype($exception),
41 1
            '{envelope}' => $envelope->getName(),
42 1
        ];
43
44 1
        return strtr('[bernard] caught unknown error type {type} while processing {envelope}.', $replacements);
45
    }
46
47
    /**
48
     * @return array
49
     */
50 1
    public static function getSubscribedEvents()
51
    {
52
        return [
53 1
            'bernard.reject' => ['onReject'],
54 1
        ];
55
    }
56
}
57