Passed
Push — master ( 6aed0c...b25483 )
by Joachim
03:39
created

PhpTemplatesRenderer   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 21
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A render() 0 3 1
A supports() 0 3 1
A __construct() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Setono\TagBag\Renderer;
6
7
use Setono\PhpTemplates\Engine\EngineInterface;
8
use Setono\TagBag\Tag\PhpTemplatesTagInterface;
9
use Setono\TagBag\Tag\TagInterface;
10
11
final class PhpTemplatesRenderer implements RendererInterface
12
{
13
    /** @var EngineInterface */
14
    private $engine;
15
16 3
    public function __construct(EngineInterface $engine)
17
    {
18 3
        $this->engine = $engine;
19 3
    }
20
21 2
    public function supports(TagInterface $tag): bool
22
    {
23 2
        return $tag instanceof PhpTemplatesTagInterface;
24
    }
25
26
    /**
27
     * @param PhpTemplatesTagInterface|TagInterface $tag
28
     */
29 1
    public function render(TagInterface $tag): string
30
    {
31 1
        return $this->engine->render($tag->getTemplate(), $tag->getContext());
0 ignored issues
show
Bug introduced by
The method getTemplate() does not exist on Setono\TagBag\Tag\TagInterface. It seems like you code against a sub-type of Setono\TagBag\Tag\TagInterface such as Setono\TagBag\Tag\PhpTemplatesTagInterface or Setono\TagBag\Tag\PhpTemplatesTag. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

31
        return $this->engine->render($tag->/** @scrutinizer ignore-call */ getTemplate(), $tag->getContext());
Loading history...
Bug introduced by
The method getContext() does not exist on Setono\TagBag\Tag\TagInterface. It seems like you code against a sub-type of Setono\TagBag\Tag\TagInterface such as Setono\TagBag\Tag\PhpTemplatesTagInterface or Setono\TagBag\Tag\PhpTemplatesTag. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

31
        return $this->engine->render($tag->getTemplate(), $tag->/** @scrutinizer ignore-call */ getContext());
Loading history...
32
    }
33
}
34