Url::decorate()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 1
dl 0
loc 10
rs 9.9332
c 0
b 0
f 0
1
<?php
2
3
namespace Boduch\Grid\Decorators;
4
5
use Boduch\Grid\Cell;
6
7
class Url extends Decorator
8
{
9
    /**
10
     * @param Cell $cell
11
     * @return void
12
     */
13
    public function decorate(Cell $cell)
14
    {
15
        $url = (string) $cell->getUnescapedValue();
16
        // disable auto escape so we can display <a> html tag in cell
17
        $cell->getColumn()->setAutoescape(false);
18
19
        $cell->setValue(
20
            $cell->getColumn()->getGrid()->getGridHelper()->getHtmlBuilder()->tag('a', $url, ['href' => $url])
21
        );
22
    }
23
}
24