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.

SimpleCommandTranslator::toCommandHandler()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 10

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2

Importance

Changes 0
Metric Value
cc 2
nc 2
nop 1
dl 0
loc 10
ccs 5
cts 5
cp 1
crap 2
rs 9.9332
c 0
b 0
f 0
1
<?php
2
namespace SmoothPhp\CommandBus;
3
4
use SmoothPhp\CommandBus\Exception\HandlerNotFound;
5
use SmoothPhp\Contracts\CommandBus\CommandTranslator;
6
7
/**
8
 * Class SimpleCommandTranslator
9
 * @package SmoothPhp\CommandBus
10
 * @author Simon Bennett <[email protected]>
11
 */
12
final class SimpleCommandTranslator implements CommandTranslator
13
{
14
    /**
15
     * @param $command
16
     * @return string
17
     */
18 12
    public function toCommandHandler($command)
19
    {
20 12
        $handler = get_class($command) . 'Handler';
21
22 12
        if (!class_exists($handler)) {
23 3
            throw new HandlerNotFound($command);
24
        }
25
26 9
        return $handler;
27
    }
28
}