Completed
Push — master ( 3b2a6f...c50757 )
by Nikolas
05:45
created

TextRenderer   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

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

2 Methods

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