Completed
Push — 1.x ( c183a4...05b51a )
by Alexander
8s
created

MethodInvocationComposer::compose()   B

Complexity

Conditions 5
Paths 8

Size

Total Lines 18
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 30

Importance

Changes 3
Bugs 0 Features 0
Metric Value
c 3
b 0
f 0
dl 0
loc 18
ccs 0
cts 10
cp 0
rs 8.8571
cc 5
eloc 10
nc 8
nop 3
crap 30
1
<?php
2
/*
3
 * Go! AOP framework
4
 *
5
 * @copyright Copyright 2011, Lisachenko Alexander <[email protected]>
6
 *
7
 * This source file is subject to the license that is bundled
8
 * with this source code in the file LICENSE.
9
 */
10
11
namespace Go\Aop\Framework;
12
13
/**
14
 * Composer for method invocations
15
 *
16
 * This technique allows to build a class for maximum performance of method invocation
17
 */
18
class MethodInvocationComposer
19
{
20
    /**
21
     * Composes a class with specific features and returns its name
22
     *
23
     * @param bool $isStatic Static or dynamic method
24
     * @param bool $useSplatOperator Enables usage of optimized invocation with splat operator
25
     * @param bool $useVariadics Enables usage of optimized invocation with variadic args
26
     *
27
     * @return string Name of composed class
28
     */
29
    public static function compose($isStatic, $useSplatOperator, $useVariadics)
30
    {
31
        $className = __NAMESPACE__ . '\\';
32
        $className .= $isStatic ? 'Static' : 'Dynamic';
33
34
        $className .= 'Closure';
35
        if ($useSplatOperator && !$isStatic) {
36
            $className .= 'Splat';
37
        }
38
39
        if ($useVariadics) {
40
            $className .= 'Variadic';
41
        }
42
43
        $className .= 'MethodInvocation';
44
45
        return $className;
46
    }
47
}
48