Completed
Push — master ( 00d73b...7020aa )
by Tom
03:28
created

TwigElement::render()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace Curlyspoon\Core\Elements;
4
5
use Twig_Loader_Filesystem;
6
use Twig_Environment;
7
8
abstract class TwigElement extends Element
9
{
10
    public function render(): string
11
    {
12
        return $this->getEngine()->render($this->name.'.twig', $this->getOptions());
13
    }
14
15
    abstract protected function getPath(): string;
16
17
    protected function getEngine(): Twig_Environment
18
    {
19
        $loader = new Twig_Loader_Filesystem($this->getPath());
20
        return new Twig_Environment($loader);
21
    }
22
}
23