Completed
Push — master ( cf4438...3af4fe )
by Дмитрий
04:06
created

Closure   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 17
ccs 0
cts 5
cp 0
rs 10
wmc 1
lcom 0
cbo 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A compile() 0 7 1
1
<?php
2
/**
3
 * @author Patsura Dmitry https://github.com/ovr <[email protected]>
4
 */
5
6
namespace PHPSA\Compiler\Expression;
7
8
use PHPSA\CompiledExpression;
9
use PHPSA\Context;
10
use PHPSA\Definition\ClosureDefinition;
11
12
class Closure extends AbstractExpressionCompiler
13
{
14
    protected $name = \PhpParser\Node\Expr\Closure::class;
15
16
    /**
17
     * @param \PhpParser\Node\Expr\Closure $expr
18
     * @param Context $context
19
     * @return mixed
20
     */
21
    protected function compile($expr, Context $context)
22
    {
23
        return new CompiledExpression(
24
            CompiledExpression::CALLABLE_TYPE,
25
            new ClosureDefinition($expr)
26
        );
27
    }
28
}
29