AbstractVisitor::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace Solidifier\Parser\Visitors;
4
5
use PhpParser\NodeVisitorAbstract;
6
use Solidifier\Visitor;
7
use Solidifier\Dispatchers\NullDispatcher;
8
use Solidifier\Dispatcher;
9
use Solidifier\Defect;
10
11
abstract class AbstractVisitor extends NodeVisitorAbstract implements Visitor
12
{
13
    protected
14
        $dispatcher;
0 ignored issues
show
Coding Style introduced by
The visibility should be declared for property $dispatcher.

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
        $this->dispatcher = new NullDispatcher();
19
    }
20
    
21
    public function setDispatcher(Dispatcher $dispatcher)
22
    {
23
        $this->dispatcher = $dispatcher;
24
        
25
        return $this;
26
    }
27
    
28
    protected function dispatch(Defect $event)
29
    {
30
        return $this->dispatcher->dispatch($event);
31
    }
32
}