PlatesFormatter   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 3
dl 0
loc 36
ccs 9
cts 9
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A body() 0 4 1
A render() 0 7 1
1
<?php
2
3
namespace Equip\Formatter;
4
5
use Equip\Adr\PayloadInterface;
6
use Equip\Formatter\HtmlFormatter;
7
use League\Plates\Engine;
8
9
class PlatesFormatter extends HtmlFormatter
10
{
11
    /**
12
     * @var Engine
13
     */
14
    private $engine;
15
16
    /**
17
     * @param Engine $engine
18
     */
19 3
    public function __construct(Engine $engine)
20
    {
21 3
        $this->engine = $engine;
22 3
    }
23
24
    /**
25
     * @inheritDoc
26
     */
27 1
    public function body(PayloadInterface $payload)
28
    {
29 1
        return $this->render($payload);
30
    }
31
32
    /**
33
     * @param PayloadInterface $payload
34
     *
35
     * @return string
36
     */
37 1
    private function render(PayloadInterface $payload)
38
    {
39 1
        $template = $payload->getSetting('template');
40 1
        $output = $payload->getOutput();
41
42 1
        return $this->engine->render($template, $output);
43
    }
44
}
45