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

GraphNodeReflectionExtension   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 0
dl 0
loc 21
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A hasProperty() 0 8 2
A getProperty() 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\Graph;
17
use phpDocumentor\GraphViz\Node;
18
use PHPStan\Reflection\Annotations\AnnotationPropertyReflection;
19
use PHPStan\Reflection\ClassReflection;
20
use PHPStan\Reflection\PropertiesClassReflectionExtension;
21
use PHPStan\Reflection\PropertyReflection;
22
use PHPStan\Type\ObjectType;
23
24
final class GraphNodeReflectionExtension implements PropertiesClassReflectionExtension
25
{
26
    public function hasProperty(ClassReflection $classReflection, string $propertyName) : bool
27
    {
28
        if ($classReflection->getName() === Graph::class) {
29
            return true;
30
        }
31
32
        return false;
33
    }
34
35
    public function getProperty(ClassReflection $classReflection, string $propertyName) : PropertyReflection
36
    {
37
        return new AnnotationPropertyReflection(
38
            $classReflection,
39
            new ObjectType(Node::class),
40
            true,
41
            true
42
        );
43
    }
44
}
45