RenderContentRuntime::renderContent()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 5
rs 10
1
<?php
2
3
/*
4
 * This file was created by developers working at BitBag
5
 * Do you need more information about us and what we do? Visit our https://bitbag.io website!
6
 * We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
7
*/
8
9
declare(strict_types=1);
10
11
namespace BitBag\SyliusCmsPlugin\Twig\Runtime;
12
13
use BitBag\SyliusCmsPlugin\Entity\ContentableInterface;
14
use BitBag\SyliusCmsPlugin\Twig\Parser\ContentParserInterface;
15
16
final class RenderContentRuntime implements RenderContentRuntimeInterface
17
{
18
    /** @var ContentParserInterface */
19
    private $contentParser;
20
21
    public function __construct(ContentParserInterface $contentParser)
22
    {
23
        $this->contentParser = $contentParser;
24
    }
25
26
    public function renderContent(ContentableInterface $contentableResource): string
27
    {
28
        $content = html_entity_decode((string) $contentableResource->getContent(), \ENT_QUOTES);
29
30
        return $this->contentParser->parse($content);
31
    }
32
}
33