Completed
Pull Request — master (#149)
by Enrico
03:54
created

PrintOp::compile()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
nc 1
nop 2
dl 0
loc 6
ccs 3
cts 3
cp 1
crap 1
rs 9.4285
c 1
b 0
f 0
1
<?php
2
3
namespace PHPSA\Compiler\Expression;
4
5
use PHPSA\CompiledExpression;
6
use PHPSA\Context;
7
use PHPSA\Compiler\Expression;
8
use PHPSA\Compiler\Expression\AbstractExpressionCompiler;
9
10
class PrintOp extends AbstractExpressionCompiler
11
{
12
    protected $name = 'PhpParser\Node\Expr\Print_';
13
14
    /**
15
     * print({expr})
16
     *
17
     * @param \PhpParser\Node\Expr\Print_ $expr
18
     * @param Context $context
19
     * @return CompiledExpression
20
     */
21 2
    protected function compile($expr, Context $context)
22
    {
23 2
        $context->getExpressionCompiler()->compile($expr->expr);
24
25 2
        return CompiledExpression::fromZvalValue(1);
26
    }
27
}
28