ExpressionNode::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 3
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
c 3
b 0
f 0
nc 1
nop 2
dl 0
loc 5
rs 9.4285
1
<?php
2
3
namespace Patron;
4
5
class ExpressionNode extends Node
6
{
7
	const REGEX = '~\#\{(?!\s)([^\}]+)\}~';
8
9
	protected $expression;
10
	protected $escape;
11
12
	public function __construct($expression, $escape)
13
	{
14
		$this->expression = $expression;
15
		$this->escape = $escape;
16
	}
17
18
	public function __invoke(Engine $engine, $context)
19
	{
20
		$rc = $this->render($this->expression);
21
22
		if ($this->escape)
23
		{
24
			$rc = \ICanBoogie\escape($rc);
25
		}
26
27
		return $rc;
28
	}
29
30
	protected function render($expression)
31
	{
32
		return $expression;
33
	}
34
}
35