Html   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
c 1
b 0
f 0
lcom 1
cbo 1
dl 0
loc 31
ccs 8
cts 8
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A asLink() 0 7 2
A asImage() 0 8 2
1
<?php
2
3
namespace Benrowe\Formatter\Providers;
4
5
use Benrowe\Formatter\AbstractFormatterProvider;
6
7
/**
8
 * Provides formatters that produce specific html based output
9
 *
10
 * @package Benrowe\Formatter
11
 */
12
class Html extends AbstractFormatterProvider
13
{
14
    /**
15
     * Format the value as a html link
16
     *
17
     * @param  string $value link
18
     * @return string
19
     */
20 2
    public function asLink($value)
21
    {
22 2
        if ($value === null) {
23 1
            return $this->nullValue;
24
        }
25 1
        return '<a href="'.$value.'">'.$value.'</a>';
26
    }
27
28
    /**
29
     * Format the value as a html image
30
     *
31
     * @param  string $value image url
32
     * @return string
33
     */
34 2
    public function asImage($value)
35
    {
36 2
        if ($value === null) {
37 1
            return $this->nullValue;
38
        }
39
40 1
        return '<img src="'.$value.'">';
41
    }
42
}
43