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

CommandNameExtractor   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 1 Features 2
Metric Value
wmc 4
c 2
b 1
f 2
lcom 0
cbo 0
dl 0
loc 25
ccs 7
cts 7
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A extractName() 0 8 2
A canExtractName() 0 5 2
1
<?php
2
3
namespace RemiSan\Serializer\NameExtractor\Tactician;
4
5
use League\Tactician\Plugins\NamedCommand\NamedCommand;
6
use RemiSan\Serializer\SerializableClassNameExtractor;
7
8
class CommandNameExtractor 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(NamedCommand::class) && defined($class.'::NAME');
31
    }
32
}
33