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

Html::asLink()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 7
ccs 4
cts 4
cp 1
rs 9.4285
cc 2
eloc 4
nc 2
nop 1
crap 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