UrlFormatter::format()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 2
nc 2
nop 1
1
<?php
2
3
namespace Itstructure\DetailView\Formatters;
4
5
/**
6
 * Class UrlFormatter
7
 * @package Itstructure\DetailView\Formatters
8
 */
9
class UrlFormatter extends BaseFormatter
10
{
11
    /**
12
     * @var string
13
     */
14
    protected $title = '';
15
16
    /**
17
     * Format value as url.
18
     * @param $value
19
     * @return mixed|string
20
     */
21
    public function format($value)
22
    {
23
        return '<a href="' . $value . '" ' . $this->buildHtmlAttributes() . ' >' . !empty($this->title) ? $this->title : $value . '</a>';
24
    }
25
}
26