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
Push — master ( 403b1f...e5b3de )
by Rémi
02:35
created

EventNameExtractor::canExtractName()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 2

Importance

Changes 2
Bugs 1 Features 2
Metric Value
c 2
b 1
f 2
dl 0
loc 5
ccs 3
cts 3
cp 1
rs 9.4285
cc 2
eloc 3
nc 2
nop 1
crap 2
1
<?php
2
3
namespace RemiSan\Serializer\NameExtractor\Event;
4
5
use League\Event\EventInterface;
6
use RemiSan\Serializer\SerializableClassNameExtractor;
7
8
class EventNameExtractor implements SerializableClassNameExtractor
9
{
10
    /**
11
     * @param  string $class
12
     * @return string
13
     */
14 6
    public function extractName($class)
15
    {
16 6
        if (! $this->canExtractName($class)) {
17 3
            throw new \InvalidArgumentException();
18
        }
19
20 3
        return $class::NAME;
21
    }
22
23
    /**
24
     * @param  string $class
25
     * @return bool
26
     */
27 15
    public function canExtractName($class)
28
    {
29 15
        $reflection = new \ReflectionClass($class);
30 15
        return $reflection->implementsInterface(EventInterface::class) && defined($class.'::NAME');
31
    }
32
}
33