Sleep::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 20
Code Lines 16

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 20
rs 9.4285
cc 1
eloc 16
nc 1
nop 4
1
<?php
2
3
namespace Isolate\LazyObjects\Proxy\Adapter\OcramiusProxyManager\MethodGenerator;
4
5
use ProxyManager\Generator\MethodGenerator;
6
use Zend\Code\Generator\PropertyGenerator;
7
8
class Sleep extends MethodGenerator
9
{
10
    /**
11
     * Constructor
12
     */
13
    public function __construct(
14
        PropertyGenerator $wrappedObjectProperty,
15
        PropertyGenerator $initializerProperty,
16
        PropertyGenerator $lazyPropertiesProperty,
17
        PropertyGenerator $methodReplacementsProperty
18
    ) {
19
        parent::__construct('__sleep');
20
        $wrappedObject = $wrappedObjectProperty->getName();
21
        $initializer = $initializerProperty->getName();
22
        $lazyProperties = $lazyPropertiesProperty->getName();
23
        $methodReplacements  = $methodReplacementsProperty->getName();
24
25
        $this->setBody(sprintf(
26
            "return array(\"%s\", \"%s\", \"%s\", \"%s\");",
27
            $wrappedObject,
28
            $initializer,
29
            $lazyProperties,
30
            $methodReplacements
31
        ));
32
    }
33
}
34