Test Failed
Push — master ( b7ab7b...94ee03 )
by Kirill
02:59
created

TypeNamePrimitive   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 0%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A __toString() 0 6 2
1
<?php
2
/**
3
 * This file is part of Railt package.
4
 *
5
 * For the full copyright and license information, please view the LICENSE
6
 * file that was distributed with this source code.
7
 */
8
declare(strict_types=1);
9
10
namespace Railt\SDL\IR\SymbolTable;
11
12
use Railt\SDL\IR\Type\TypeNameInterface;
13
14
/**
15
 * Class TypeNamePrimitive
16
 */
17
class TypeNamePrimitive implements PrimitiveInterface
18
{
19
    /**
20
     * @var TypeNameInterface
21
     */
22
    private $name;
23
24
    /**
25
     * TypeNamePrimitive constructor.
26
     * @param TypeNameInterface $name
27
     */
28
    public function __construct(TypeNameInterface $name)
29
    {
30
        $this->name = $name;
31
    }
32
33
    /**
34
     * @return string
35
     */
36
    public function __toString(): string
37
    {
38
        $prefix = $this->name->isGlobal() ? TypeNameInterface::NAMESPACE_SEPARATOR : '';
39
40
        return $prefix . $this->name->getFullyQualifiedName();
41
    }
42
}
43