Completed
Push — master ( b268cf...c6aad7 )
by Oliver
07:45
created

NamedCommand   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 1
dl 0
loc 34
ccs 0
cts 12
cp 0
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getName() 0 4 1
A __toString() 0 4 1
1
<?php
2
3
namespace Metabor\Statemachine;
4
5
use MetaborStd\NamedInterface;
6
7
/**
8
 * @author Oliver Tischlinger
9
 */
10
abstract class NamedCommand extends Command implements NamedInterface
11
{
12
    /**
13
     * @var string
14
     */
15
    private $name;
16
17
    /**
18
     * @param string $name
19
     */
20
    public function __construct($name)
21
    {
22
        $this->name = $name;
23
    }
24
25
    /**
26
     * @see \MetaborStd\NamedInterface::getName()
27
     */
28
    public function getName()
29
    {
30
        return $this->name;
31
    }
32
33
    /**
34
     * I would require to provide a name because its really needed for visualisation
35
     * and the class name might be very long and not very descriptive.
36
     *
37
     * @return string
38
     */
39
    public function __toString()
40
    {
41
        return $this->getName();
42
    }
43
}
44