Completed
Push — master ( ce6f95...09fff3 )
by Roberts
05:17 queued 36s
created

Cell::getColumn()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Arbory\Base\Admin\Grid;
4
5
use Arbory\Base\Html\Elements\Element;
6
use Arbory\Base\Html\Html;
7
use Illuminate\Contracts\Support\Renderable;
8
use Illuminate\Database\Eloquent\Model;
9
10
/**
11
 * Class Cell
12
 * @package Arbory\Base\Admin\Grid
13
 */
14
class Cell implements Renderable
15
{
16
    /**
17
     * @var Column
18
     */
19
    protected $column;
20
21
    /**
22
     * @var Row
23
     */
24
    protected $row;
25
26
    /**
27
     * @var Model
28
     */
29
    protected $model;
30
31
    /**
32
     * Cell constructor.
33
     * @param Column $column
34
     * @param Row $row
35
     * @param Model $model
36
     */
37
    public function __construct(Column $column, Row $row, Model $model)
38
    {
39
        $this->column = $column;
40
        $this->row = $row;
41
        $this->model = $model;
42
    }
43
44
    /**
45
     * @return string
46
     */
47
    public function __toString()
48
    {
49
        return (string)$this->render();
50
    }
51
52
    /**
53
     * @return Column
54
     */
55
    public function getColumn()
56
    {
57
        return $this->column;
58
    }
59
60
    /**
61
     * @return Row
62
     */
63
    public function getRow()
64
    {
65
        return $this->row;
66
    }
67
68
    /**
69
     * @return Model
70
     */
71
    public function getModel()
72
    {
73
        return $this->model;
74
    }
75
76
    /**
77
     * @return Element
78
     */
79
    public function render()
80
    {
81
        return Html::td($this->getColumn()->callDisplayCallback($this->getModel()));
82
    }
83
84
}
85