ObjectTypes   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 6
lcom 1
cbo 2
dl 0
loc 25
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A enter() 0 7 4
A getObjectTypes() 0 4 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