Completed
Push — master ( bca24d...1b0d8b )
by John
03:18
created

ClosureVisitor   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
lcom 1
cbo 0
dl 0
loc 32
rs 10
c 1
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A visit() 0 4 1
1
<?php declare(strict_types = 1);
2
/*
3
 * This file is part of the KleijnWeb\PhpApi\Descriptions package.
4
 *
5
 * For the full copyright and license information, please view the LICENSE
6
 * file that was distributed with this source code.
7
 */
8
namespace KleijnWeb\PhpApi\Descriptions\Description\Visitor;
9
10
/**
11
 * @author John Kleijn <[email protected]>
12
 */
13
class ClosureVisitor implements Visitor
14
{
15
    /**
16
     * @var \Closure
17
     */
18
    private $closure;
19
20
    /**
21
     * @var object
22
     */
23
    private $scope;
24
25
    /**
26
     * @param ClosureVisitorScope $scope
27
     * @param \Closure            $closure
28
     */
29
    public function __construct(ClosureVisitorScope $scope, \Closure $closure)
30
    {
31
        $this->closure = $closure;
32
        $this->scope   = $scope;
33
    }
34
35
    /**
36
     * @param Visitee $element
37
     *
38
     * @return mixed|void
39
     */
40
    public function visit(Visitee $element)
41
    {
42
        $this->closure->call($this->scope, $element);
43
    }
44
}
45