HtmlRenderer   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
dl 0
loc 20
c 0
b 0
f 0
wmc 2
lcom 0
cbo 2
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A handles() 0 3 1
A render() 0 5 1
1
<?php
2
namespace rtens\domin\delivery\web\renderers;
3
4
use rtens\domin\delivery\Renderer;
5
use rtens\domin\parameters\Html;
6
use rtens\domin\delivery\web\Element;
7
8
class HtmlRenderer implements Renderer {
9
10
    /**
11
     * @param mixed $value
12
     * @return bool
13
     */
14
    public function handles($value) {
15
        return $value instanceof Html;
16
    }
17
18
    /**
19
     * @param Html $value
20
     * @return string
21
     */
22
    public function render($value) {
23
        return (string)new Element('div', ['style' => 'border: 1px solid black; padding: 5pt;'], [
24
            $value->getContent()
25
        ]);
26
    }
27
}