Bus::execute()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 5
rs 10
1
<?php
2
3
namespace diecoding\aws\s3;
4
5
use diecoding\aws\s3\interfaces;
6
7
/**
8
 * Class Bus
9
 *
10
 * @package diecoding\aws\s3
11
 */
12
class Bus implements interfaces\Bus
13
{
14
    /** @var interfaces\HandlerResolver */
15
    protected $resolver;
16
17
    /**
18
     * Bus constructor.
19
     *
20
     * @param \diecoding\aws\s3\interfaces\HandlerResolver $inflector
21
     */
22
    public function __construct(interfaces\HandlerResolver $inflector)
23
    {
24
        $this->resolver = $inflector;
25
    }
26
27
    /**
28
     * @param \diecoding\aws\s3\interfaces\commands\Command $command
29
     *
30
     * @return mixed
31
     */
32
    public function execute(interfaces\commands\Command $command)
33
    {
34
        $handler = $this->resolver->resolve($command);
35
        
36
        return call_user_func([$handler, 'handle'], $command);
37
    }
38
}
39