VisiteeTrait::accept()   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 1
1
<?php
2
3
/**
4
 * This file is part of the Cubiche package.
5
 *
6
 * Copyright (c) Cubiche
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
namespace Cubiche\Core\Visitor;
12
13
/**
14
 * Visitee trait.
15
 *
16
 * @author Karel Osorio Ramírez <[email protected]>
17
 */
18
trait VisiteeTrait
19
{
20
    /**
21
     * @param VisitorInterface $visitor
22
     *
23
     * @return mixed
24
     */
25
    public function accept(VisitorInterface $visitor)
26
    {
27
        return $this->delegateAccept($this, $visitor, \func_get_args());
28
    }
29
30
    /**
31
     * @param VisiteeInterface $visitee
32
     * @param VisitorInterface $visitor
33
     * @param array            $args
34
     *
35
     * @return mixed
36
     */
37
    protected function delegateAccept(VisiteeInterface $visitee, VisitorInterface $visitor, array $args)
38
    {
39
        $args[0] = $visitee;
40
41
        return \call_user_func_array(array($visitor, 'visit'), $args);
42
    }
43
}
44