TwigElement   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 3
dl 0
loc 16
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
getPath() 0 1 ?
A render() 0 4 1
A getEngine() 0 6 1
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