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   A
last analyzed

Complexity

Total Complexity 8

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
dl 0
loc 35
c 0
b 0
f 0
wmc 8
lcom 1
cbo 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
B dispatch() 0 16 7
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