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.

SilentBus::dispatch()   B
last analyzed

Complexity

Conditions 7
Paths 4

Size

Total Lines 16
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 16
c 0
b 0
f 0
rs 8.2222
cc 7
eloc 8
nc 4
nop 1
1
<?php
2
3
namespace Isolate\UnitOfWork\CommandBus;
4
5
use Isolate\UnitOfWork\Command\Command;
6
use Isolate\UnitOfWork\Command\EditCommand;
7
use Isolate\UnitOfWork\Command\NewCommand;
8
use Isolate\UnitOfWork\Command\RemoveCommand;
9
use Isolate\UnitOfWork\CommandBus;
10
use Isolate\UnitOfWork\Entity\Definition\Repository;
11
12
class SilentBus implements CommandBus
13
{
14
    /**
15
     * @var Repository
16
     */
17
    private $definitions;
18
19
    /**
20
     * @param Repository $definitions
21
     */
22
    public function __construct(Repository $definitions)
23
    {
24
        $this->definitions = $definitions;
25
    }
26
27
    /**
28
     * @param Command $command
29
     */
30
    public function dispatch(Command $command)
31
    {
32
        $definition = $this->definitions->getDefinition($command->getEntity());
33
34
        if ($command instanceof NewCommand && $definition->hasNewCommandHandler()) {
35
            return $definition->getNewCommandHandler()->handle($command);
36
        }
37
38
        if ($command instanceof EditCommand && $definition->hasEditCommandHandler()) {
39
            return $definition->getEditCommandHandler()->handle($command);
40
        }
41
42
        if ($command instanceof RemoveCommand && $definition->hasRemoveCommandHandler()) {
43
            return $definition->getRemoveCommandHandler()->handle($command);
44
        }
45
    }
46
}
47