Completed
Pull Request — master (#9)
by Adam
11:38
created

AurynCommandFactory   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 1 Features 1
Metric Value
wmc 3
c 2
b 1
f 1
lcom 1
cbo 2
dl 0
loc 26
ccs 8
cts 8
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A make() 0 10 2
1
<?php
2
3
namespace Equip\Queue\Command;
4
5
use Auryn\Injector;
6
use Equip\Command\CommandInterface;
7
use Equip\Queue\Exception\CommandException;
8
9
class AurynCommandFactory implements CommandFactoryInterface
10
{
11
    /**
12
     * @var Injector
13
     */
14
    private $injector;
15
16 2
    public function __construct(Injector $injector)
17
    {
18 2
        $this->injector = $injector;
19 2
    }
20
21
    /**
22
     * @inheritdoc
23
     */
24 2
    public function make($command)
25
    {
26 2
        $command = $this->injector->make($command);
27
28 2
        if (!is_a($command, CommandInterface::class)) {
29 1
            throw CommandException::invalidCommand($command);
30
        }
31
32 1
        return $command;
33
    }
34
}
35