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

MethodInvocationComposer   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 0%

Importance

Changes 3
Bugs 0 Features 0
Metric Value
wmc 5
c 3
b 0
f 0
lcom 0
cbo 0
dl 0
loc 30
ccs 0
cts 10
cp 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
B compose() 0 18 5
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