ObjectTypes::enter()   A
last analyzed

Complexity

Conditions 4
Paths 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 9.2
c 0
b 0
f 0
cc 4
eloc 3
nc 2
nop 1
1
<?php
2
3
namespace Solidifier\Visitors\PreAnalyze;
4
5
use Solidifier\Parser\Visitors\ContextualVisitor;
6
use PhpParser\Node;
7
use PhpParser\Node\Stmt\Class_;
8
use PhpParser\Node\Stmt\Interface_;
9
use PhpParser\Node\Stmt\Trait_;
10
11
class ObjectTypes extends ContextualVisitor
12
{
13
    private
14
        $types;
0 ignored issues
show
Coding Style introduced by
The visibility should be declared for property $types.

The PSR-2 coding standard requires that all properties in a class have their visibility explicitly declared. If you declare a property using

class A {
    var $property;
}

the property is implicitly global.

To learn more about the PSR-2, please see the PHP-FIG site on the PSR-2.

Loading history...
15
    
16
    public function __construct()
17
    {
18
        parent::__construct();
19
        
20
        $this->types = array();
21
    }
22
    
23
    protected function enter(Node $node)
24
    {
25
        if($node instanceof Class_ || $node instanceof Interface_ || $node instanceof Trait_)
26
        {
27
            $this->types[$this->currentObjectType->fullname] = $this->currentObjectType->type;
28
        }
29
    }
30
    
31
    public function getObjectTypes()
32
    {
33
        return $this->types;
34
    }
35
}
36