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.

SentryEventRecorder::getAllEventIds()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace Classmarkets\RavenBundle;
4
5
class SentryEventRecorder
6
{
7
    /** @var string[] */
8
    private $idStore = [];
9
10
    /**
11
     * @param object $exception
12
     * @param string $id
13
     */
14
    public function addExceptionEventId($exception, $id)
15
    {
16
        if (is_object($exception) && !empty($id)) {
17
            $this->idStore[spl_object_hash($exception)] = $id;
18
        }
19
    }
20
21
    /** @return string|null */
22
    public function getEventIdForException($exception)
23
    {
24
        if (!is_object($exception)) {
25
            return null;
26
        }
27
28
        $hash = spl_object_hash($exception);
29
30
        if (isset($this->idStore[$hash])) {
31
            return $this->idStore[$hash];
32
        }
33
34
        return null;
35
    }
36
37
    /** @return string[] */
38
    public function getAllEventIds()
39
    {
40
        return array_unique(array_values($this->idStore));
41
    }
42
43
    /**
44
     * Store the same event id for $aliasException as for $originalException.
45
     *
46
     * @param object $originalException
47
     * @param object $aliasException
48
     */
49
    public function addExceptionAlias($originalException, $aliasException)
50
    {
51
        if ($eventId = $this->getEventIdForException($originalException)) {
52
            $this->addExceptionEventId($aliasException, $eventId);
53
        }
54
    }
55
}
56