Test Failed
Push — master ( a380eb...a52ae2 )
by Hannes
01:59
created

ExampleName   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 9
dl 0
loc 32
rs 10
c 0
b 0
f 0
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getNamespaceName() 0 3 1
A __construct() 0 4 1
A getShortName() 0 3 1
A equals() 0 3 1
A getCompleteName() 0 3 1
1
<?php
2
3
declare(strict_types = 1);
4
5
namespace hanneskod\readmetester\Name;
6
7
final class ExampleName implements NameInterface
8
{
9
    /** @var string */
10
    private $shortName;
11
12
    /** @var string */
13
    private $namespace;
14
15
    public function __construct(string $shortName, string $namespace)
16
    {
17
        $this->shortName = $shortName;
18
        $this->namespace = $namespace;
19
    }
20
21
    public function getCompleteName(): string
22
    {
23
        return $this->getNamespaceName() . self::NAME_DELIMITER . $this->getShortName();
24
    }
25
26
    public function getShortName(): string
27
    {
28
        return $this->shortName;
29
    }
30
31
    public function getNamespaceName(): string
32
    {
33
        return $this->namespace;
34
    }
35
36
    public function equals(NameInterface $name): bool
37
    {
38
        return $name->getCompleteName() == $this->getCompleteName();
39
    }
40
}
41