EvalEvaluator   A
last analyzed

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 evaluate() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace RulerZ\Compiler;
6
7
/**
8
 * Evaluates PHP code using the `eval` function.
9
 *
10
 * Usage:
11
 *
12
 * ```
13
 * $evaluator = new EvalEvaluator();
14
 * $evaluator->evaluate('some-rule-unique-identifier', function() {
15
 *     return "echo 'Hello World';";
16
 * });
17
 * ```
18
 */
19
class EvalEvaluator implements Evaluator
20
{
21
    public function evaluate(string $ruleIdentifier, callable $compiler): void
22
    {
23
        eval($compiler());
24
    }
25
}
26