Completed
Push — master ( 6ec6b5...364731 )
by Adam
02:30
created

RowAction::getGrid()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 4
rs 10
c 1
b 0
f 0
1
<?php
2
3
namespace Boduch\Grid\Components;
4
5
abstract class RowAction extends Component
6
{
7
    /**
8
     * @var \Closure
9
     */
10
    protected $closure;
11
12
    /**
13
     * @var mixed
14
     */
15
    protected $data;
16
17
    /**
18
     * RowAction constructor.
19
     * @param \Closure $url
20
     */
21
    public function __construct(\Closure $url)
22
    {
23
        $this->setClosure($url);
24
    }
25
26
    /**
27
     * @return string
28
     */
29
    public function getClosure()
30
    {
31
        return $this->closure;
32
    }
33
34
    /**
35
     * @param \Closure $closure
36
     */
37
    public function setClosure(\Closure $closure)
38
    {
39
        $this->closure = $closure;
40
    }
41
42
    /**
43
     * @return mixed
44
     */
45
    public function getData()
46
    {
47
        return $this->data;
48
    }
49
50
    /**
51
     * @param mixed $data
52
     * @return $this
53
     */
54
    public function setData($data)
55
    {
56
        $this->data = $data;
57
58
        return $this;
59
    }
60
61
    /**
62
     * @param $data
63
     * @return mixed
64
     */
65
    protected function buildActionUrl($data)
66
    {
67
        return $this->closure->call($this, $data);
68
    }
69
}
70