Completed
Push — master ( 6bd4b5...f63b4b )
by Ben
02:26
created

Html   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 0 Features 2
Metric Value
wmc 4
c 2
b 0
f 2
lcom 1
cbo 1
dl 0
loc 19
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 2
    public function asLink($value)
15
    {
16 2
        if ($value === null) {
17 1
            return $this->nullValue;
18
        }
19 1
        return '<a href="'.$value.'">'.$value.'</a>';
20
    }
21
22 2
    public function asImage($value)
23
    {
24 2
        if ($value === null) {
25 1
            return $this->nullValue;
26
        }
27
28 1
        return '<img src="'.$value.'">';
29
    }
30
}
31