EvalMaterializer::materialize()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 3
1
<?php
2
3
/**
4
 * Spiral Framework. Cycle ProxyFactory
5
 *
6
 * @license MIT
7
 * @author  Valentin V (Vvval)
8
 */
9
10
declare(strict_types=1);
11
12
namespace Cycle\ORM\Promise\Materizalizer;
13
14
use Cycle\ORM\Promise\MaterializerInterface;
15
use ReflectionClass;
16
17
use function Cycle\ORM\Promise\trimPHPOpenTag;
18
19
final class EvalMaterializer implements MaterializerInterface
20
{
21
    /**
22
     * {@inheritdoc}
23
     * If class already exists - do nothing (prevent from memory leaking)
24
     */
25
    public function materialize(string $code, string $shortClassName, ReflectionClass $reflection): void
26
    {
27
        eval(trimPHPOpenTag($code));
28
    }
29
}
30