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

ClosureVisitor::visit()   A

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 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