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.

CommandQueueingDecorator::execute()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 9
rs 9.6666
c 0
b 0
f 0
cc 2
eloc 5
nc 2
nop 1
1
<?php
2
3
namespace Chief\Decorators;
4
5
use Chief\Busses\SynchronousCommandBus;
6
use Chief\Command;
7
use Chief\CommandBus;
8
use Chief\CommandQueuer;
9
use Chief\Decorator;
10
use Chief\QueueableCommand;
11
12
/**
13
 * Queue commands which implement QueueableCommand into a CommandQueuer
14
 */
15
class CommandQueueingDecorator implements Decorator
16
{
17
    use InnerBusTrait;
18
19
    /**
20
     * @var \Chief\CommandQueuer
21
     */
22
    protected $queuer;
23
24
    /**
25
     * @param CommandQueuer $queuer
26
     * @param CommandBus $innerCommandBus
27
     */
28
    public function __construct(CommandQueuer $queuer, CommandBus $innerCommandBus = null)
29
    {
30
        $this->queuer = $queuer;
31
        $this->setInnerBus($innerCommandBus ?: new SynchronousCommandBus());
32
    }
33
34
    /**
35
     * Execute a command
36
     *
37
     * @param Command $command
38
     * @return void|mixed
39
     */
40
    public function execute(Command $command)
41
    {
42
        if ($command instanceof QueueableCommand) {
43
            $this->queuer->queue($command);
44
            return null;
45
        }
46
47
        return $this->innerCommandBus->execute($command);
48
    }
49
}
50