Completed
Pull Request — master (#465)
by Marco
23:33
created

MyProxiedClass   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 7
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
dl 0
loc 7
c 0
b 0
f 0
wmc 1
lcom 0
cbo 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A sayHello() 0 4 1
1
<?php
2
3
namespace StaticAnalysis\AccessInterceptorScopeLocalizer;
4
5
use ProxyManager\Factory\AccessInterceptorScopeLocalizerFactory;
6
7
require_once __DIR__ . '/../../vendor/autoload.php';
8
9
class MyProxiedClass
10
{
11
    public function sayHello() : string
12
    {
13
        return 'Hello!';
14
    }
15
}
16
17
echo (new AccessInterceptorScopeLocalizerFactory())
18
    ->createProxy(
19
        new MyProxiedClass(),
20
        [
21
            'sayHello' => static function (
22
                object $proxy,
0 ignored issues
show
Unused Code introduced by
The parameter $proxy is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
23
                MyProxiedClass $realInstance,
0 ignored issues
show
Unused Code introduced by
The parameter $realInstance is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
24
                string $method,
0 ignored issues
show
Unused Code introduced by
The parameter $method is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
25
                array $parameters,
0 ignored issues
show
Unused Code introduced by
The parameter $parameters is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
26
                bool & $returnEarly
0 ignored issues
show
Unused Code introduced by
The parameter $returnEarly is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
27
            ) {
28
                echo 'pre-';
29
            },
30
        ],
31
        [
32
            'sayHello' =>
33
            /** @param mixed $returnValue */
34
                static function (
35
                    object $proxy,
0 ignored issues
show
Unused Code introduced by
The parameter $proxy is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
36
                    MyProxiedClass $realInstance,
0 ignored issues
show
Unused Code introduced by
The parameter $realInstance is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
37
                    string $method,
0 ignored issues
show
Unused Code introduced by
The parameter $method is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
38
                    array $parameters,
0 ignored issues
show
Unused Code introduced by
The parameter $parameters is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
39
                    & $returnValue,
0 ignored issues
show
Unused Code introduced by
The parameter $returnValue is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
40
                    bool & $overrideReturnValue
0 ignored issues
show
Unused Code introduced by
The parameter $overrideReturnValue is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
41
                ) {
42
                    echo 'post-';
43
                },
44
        ]
45
    )
46
    ->sayHello();
47
48
$localizedAccessInterceptor = (new AccessInterceptorScopeLocalizerFactory())
49
    ->createProxy(new MyProxiedClass());
50
51
$localizedAccessInterceptor->setMethodPrefixInterceptor(
52
    'sayHello',
53
    static function (
54
        object $proxy,
0 ignored issues
show
Unused Code introduced by
The parameter $proxy is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
55
        MyProxiedClass $realInstance,
0 ignored issues
show
Unused Code introduced by
The parameter $realInstance is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
56
        string $method,
0 ignored issues
show
Unused Code introduced by
The parameter $method is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
57
        array $parameters,
0 ignored issues
show
Unused Code introduced by
The parameter $parameters is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
58
        bool & $returnEarly
0 ignored issues
show
Unused Code introduced by
The parameter $returnEarly is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
59
    ) {
60
        echo 'pre-';
61
    }
62
);
63
64
$localizedAccessInterceptor->setMethodSuffixInterceptor(
65
    'sayHello',
66
    /** @param mixed $returnValue */
67
    static function (
68
        object $proxy,
0 ignored issues
show
Unused Code introduced by
The parameter $proxy is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
69
        MyProxiedClass $realInstance,
0 ignored issues
show
Unused Code introduced by
The parameter $realInstance is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
70
        string $method,
0 ignored issues
show
Unused Code introduced by
The parameter $method is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
71
        array $parameters,
0 ignored issues
show
Unused Code introduced by
The parameter $parameters is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
72
        & $returnValue,
0 ignored issues
show
Unused Code introduced by
The parameter $returnValue is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
73
        bool & $returnEarly
0 ignored issues
show
Unused Code introduced by
The parameter $returnEarly is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
74
    ) {
75
        echo 'post-';
76
    }
77
);
78
79
echo $localizedAccessInterceptor->sayHello();
80