Completed
Push — master ( 611e0d...3b7232 )
by Kirill
02:21
created

AbstractTypeInvocation::getName()   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 2
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 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\Reflection\Invocation;
11
12
use Railt\Reflection\AbstractDefinition;
13
use Railt\Reflection\Contracts\Definition\TypeDefinition;
14
use Railt\Reflection\Contracts\Invocation\TypeInvocation;
15
use Railt\Reflection\Document;
16
17
/**
18
 * Class AbstractTypeInvocation
19
 */
20
abstract class AbstractTypeInvocation extends AbstractDefinition implements TypeInvocation
21
{
22
    /**
23
     * @var string
24
     */
25
    protected $name;
26
27
    /**
28
     * AbstractTypeInvocation constructor.
29
     * @param Document $document
30
     * @param string $name
31
     */
32 1
    public function __construct(Document $document, string $name)
33
    {
34 1
        $this->name = $name;
35
36 1
        parent::__construct($document);
37 1
    }
38
39
    /**
40
     * @return TypeDefinition
41
     */
42 1
    public function getDefinition(): TypeDefinition
43
    {
44 1
        return $this->fetch($this->name);
45
    }
46
47
    /**
48
     * @return string
49
     */
50
    public function getName(): string
51
    {
52
        return $this->name;
53
    }
54
55
    /**
56
     * @return string
57
     */
58
    public function __toString(): string
59
    {
60
        return \sprintf('%s()<%s>', $this->getName(), static::getType());
61
    }
62
}
63