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

MyProxiedClass::sayHello()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
c 0
b 0
f 0
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
namespace StaticAnalysis\LazyLoadingGhostObject;
4
5
use ProxyManager\Factory\LazyLoadingGhostFactory;
6
use ProxyManager\Proxy\LazyLoadingInterface;
7
8
require_once __DIR__ . '/../../vendor/autoload.php';
9
10
class MyProxiedClass
11
{
12
    public function sayHello() : string
13
    {
14
        return 'Hello!';
15
    }
16
}
17
18
echo (new LazyLoadingGhostFactory())
19
    ->createProxy(
20
        MyProxiedClass::class,
21
        static function (
22
            ?object & $instance,
23
            LazyLoadingInterface $proxy,
24
            string $method,
25
            array $parameters,
26
            ?\Closure & $initializer,
27
            array $properties
0 ignored issues
show
Unused Code introduced by
The parameter $properties 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...
28
        ) : bool {
29
            $initializer = null; // disable initialization
30
31
            return true;
32
        }
33
    )
34
    ->sayHello();
35
36
$lazyLoadingGhost = (new LazyLoadingGhostFactory())
37
    ->createProxy(
38
        MyProxiedClass::class,
39
        static function () : bool {
40
            return true;
41
        }
42
    );
43
44
$lazyLoadingGhost->setProxyInitializer(static function (
45
    ?object & $instance,
46
    LazyLoadingInterface $proxy,
47
    string $method,
48
    array $parameters,
49
    ?\Closure & $initializer,
50
    array $properties
0 ignored issues
show
Unused Code introduced by
The parameter $properties 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...
51
) : bool {
52
    $initializer = null; // disable initialization
53
54
    return true;
55
});
56