Link   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 0
Metric Value
dl 0
loc 30
rs 10
c 0
b 0
f 0
wmc 2
lcom 1
cbo 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A render() 0 6 1
A decorate() 0 7 1
1
<?php
2
3
namespace Boduch\Grid\Decorators;
4
5
use Boduch\Grid\Cell;
6
7
class Link extends Decorator
8
{
9
    /**
10
     * @var \Closure
11
     */
12
    protected $closure;
13
14
    /**
15
     * @param \Closure $closure
16
     * @return $this
17
     */
18
    public function render(\Closure $closure)
19
    {
20
        $this->closure = $closure;
21
22
        return $this;
23
    }
24
25
    /**
26
     * @param Cell $cell
27
     * @return void
28
     */
29
    public function decorate(Cell $cell)
30
    {
31
        // disable auto escape so we can display <a> html tag in cell
32
        $cell->getColumn()->setAutoescape(false);
33
34
        $cell->setValue($this->closure->call($cell, $cell->getData()));
35
    }
36
}
37