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

RowAction   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 65
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 65
rs 10
wmc 6
lcom 1
cbo 1

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getClosure() 0 4 1
A setClosure() 0 4 1
A getData() 0 4 1
A setData() 0 6 1
A buildActionUrl() 0 4 1
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