Completed
Push — master ( 03a7df...02e633 )
by Adam
02:32
created

Action::setValue()   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
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 4
rs 10
1
<?php
2
3
namespace Boduch\Grid;
4
5
class Action implements CellInterface
6
{
7
    /**
8
     * @var RowActions\RowAction[]
9
     */
10
    protected $rowActions;
11
12
    /**
13
     * @var mixed
14
     */
15
    protected $data;
16
17
    /**
18
     * @var Column
19
     */
20
    protected $column;
21
22
    /**
23
     * @param Column $column
24
     * @param RowActions\RowAction[] $rowActions
25
     * @param mixed $data
26
     */
27
    public function __construct(Column $column, $rowActions, $data)
28
    {
29
        $this->column = $column;
30
        $this->rowActions = $rowActions;
31
        $this->data = $data;
32
    }
33
34
    /**
35
     * @return Column
36
     */
37
    public function getColumn()
38
    {
39
        return $this->column;
40
    }
41
42
    /**
43
     * @param mixed $value
44
     */
45
    public function setValue($value)
46
    {
47
        throw new \InvalidArgumentException('Can\'t set action value.');
48
    }
49
50
    /**
51
     * @return string
52
     */
53
    public function getValue()
54
    {
55
        $html = '';
56
57
        foreach ($this->rowActions as $rowAction) {
58
            $html = $rowAction->render($this->data);
59
        }
60
61
        return $html;
62
    }
63
}
64