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.

Chief::pushDecorator()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 1
1
<?php
2
3
namespace Chief;
4
5
use Chief\Busses\SynchronousCommandBus;
6
7
/**
8
 * The main Chief class is a CommandBus, which is effectively a decorator
9
 * around another CommandBus interface
10
 *
11
 */
12
class Chief implements CommandBus
13
{
14
    /**
15
     * @var CommandBus
16
     */
17
    protected $bus;
18
19
    /**
20
     * Constructor
21
     *
22
     * @param CommandBus $bus
23
     * @param array $decorators Array of \Chief\Decorator objects
24
     */
25
    public function __construct(CommandBus $bus = null, array $decorators = [])
26
    {
27
        $this->bus = $bus ?: new SynchronousCommandBus;
28
29
        foreach ($decorators as $decorator) {
30
            $this->pushDecorator($decorator);
31
        }
32
    }
33
34
    /**
35
     * Push a new Decorator on to the stack
36
     * @param Decorator $decorator
37
     */
38
    public function pushDecorator(Decorator $decorator)
39
    {
40
        $decorator->setInnerBus($this->bus);
41
        $this->bus = $decorator;
42
    }
43
44
    /**
45
     * Execute a command
46
     *
47
     * @param Command $command
48
     * @throws \InvalidArgumentException
49
     * @return mixed
50
     */
51
    public function execute(Command $command)
52
    {
53
        return $this->bus->execute($command);
54
    }
55
}
56