Completed
Push — master ( dd8cf8...395659 )
by Jaap
08:57
created

AttributeGetterMethodReflection   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 57
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 8
lcom 0
cbo 0
dl 0
loc 57
rs 10
c 0
b 0
f 0

8 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getDeclaringClass() 0 4 1
A isStatic() 0 4 1
A isPrivate() 0 4 1
A isPublic() 0 4 1
A getName() 0 4 1
A getPrototype() 0 4 1
A getVariants() 0 9 1
1
<?php
2
3
declare(strict_types=1);
4
5
/**
6
 * phpDocumentor
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 *
11
 * @link      http://phpdoc.org
12
 */
13
14
namespace phpDocumentor\GraphViz\PHPStan;
15
16
use phpDocumentor\GraphViz\Attribute;
17
use PHPStan\Reflection\ClassMemberReflection;
18
use PHPStan\Reflection\ClassReflection;
19
use PHPStan\Reflection\FunctionVariant;
20
use PHPStan\Reflection\MethodReflection;
21
use PHPStan\Reflection\ParametersAcceptor;
22
use PHPStan\Type\ObjectType;
23
24
final class AttributeGetterMethodReflection implements MethodReflection
25
{
26
    /** @var ClassReflection */
27
    private $classReflection;
28
29
    /** @var string */
30
    private $name;
31
32
    public function __construct(ClassReflection $classReflection, string $name)
33
    {
34
        $this->classReflection = $classReflection;
35
        $this->name            = $name;
36
    }
37
38
    public function getDeclaringClass() : ClassReflection
39
    {
40
        return $this->classReflection;
41
    }
42
43
    public function isStatic() : bool
44
    {
45
        return false;
46
    }
47
48
    public function isPrivate() : bool
49
    {
50
        return false;
51
    }
52
53
    public function isPublic() : bool
54
    {
55
        return true;
56
    }
57
58
    public function getName() : string
59
    {
60
        return $this->name;
61
    }
62
63
    public function getPrototype() : ClassMemberReflection
64
    {
65
        return $this;
66
    }
67
68
    /**
69
     * @return ParametersAcceptor[]
70
     */
71
    public function getVariants() : array
72
    {
73
        return [new FunctionVariant(
74
            [],
75
            false,
76
            new ObjectType(Attribute::class)
77
        ),
78
        ];
79
    }
80
}
81