QueueCommand   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 46
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
c 1
b 0
f 0
lcom 0
cbo 0
dl 0
loc 46
ccs 12
cts 12
cp 1
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 11 2
A getCommand() 0 4 1
A getName() 0 4 1
1
<?php
2
3
namespace League\Tactician\Bernard;
4
5
/**
6
 * Wraps any command to be queueable
7
 */
8
final class QueueCommand implements QueueableCommand
9
{
10
    /**
11
     * @var object
12
     */
13
    private $command;
14
15
    /**
16
     * @var string
17
     */
18
    private $name;
19
20
    /**
21
     * @param object      $command
22
     * @param string|null $name
23
     */
24 8
    public function __construct($command, $name = null)
25
    {
26 8
        $this->command = $command;
27
28 8
        if (is_null($name)) {
29 5
            $className = get_class($command);
30 5
            $name = substr($className, strrpos($className, '\\') + 1);
31 5
        }
32
33 8
        $this->name = $name;
34 8
    }
35
36
    /**
37
     * Returns the wrapped command
38
     *
39
     * @return object
40
     */
41 4
    public function getCommand()
42
    {
43 4
        return $this->command;
44
    }
45
46
    /**
47
     * {@inheritdoc}
48
     */
49 4
    public function getName()
50
    {
51 4
        return $this->name;
52
    }
53
}
54