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

NamedCommand::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 4
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 2
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