TwigElement::getEngine()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
c 0
b 0
f 0
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Curlyspoon\Core\Elements;
4
5
use Twig_Environment;
6
use Twig_Loader_Filesystem;
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());
0 ignored issues
show
Deprecated Code introduced by
The class Twig_Loader_Filesystem has been deprecated with message: since Twig 2.7, use "Twig\Loader\FilesystemLoader" instead

This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.

Loading history...
20
21
        return new Twig_Environment($loader);
0 ignored issues
show
Deprecated Code introduced by
The class Twig_Environment has been deprecated with message: since Twig 2.7, use "Twig\Environment" instead

This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.

Loading history...
22
    }
23
}
24