1 | <?php |
||
13 | class Column { |
||
14 | |||
15 | /** @var string */ |
||
16 | private $_key; |
||
17 | |||
18 | /** @var string */ |
||
19 | private $_name; |
||
20 | |||
21 | /** @var Relation */ |
||
22 | private $_relation; |
||
23 | |||
24 | /** @var ColumnFormatter */ |
||
25 | private $_formatter; |
||
26 | |||
27 | /** |
||
28 | * Column constructor. |
||
29 | * @param string $name |
||
30 | * @param ColumnFormatter|null $columnFormatter |
||
31 | */ |
||
32 | 46 | public function __construct(string $name, ? ColumnFormatter $columnFormatter = null) |
|
37 | |||
38 | /** |
||
39 | * @param string $name |
||
40 | */ |
||
41 | 46 | private function _setName(string $name) : void |
|
57 | |||
58 | /** |
||
59 | * @return string |
||
60 | */ |
||
61 | 33 | public function getKey() : string |
|
65 | |||
66 | /** |
||
67 | * @return string |
||
68 | */ |
||
69 | 5 | public function getName() : string |
|
73 | |||
74 | /** |
||
75 | * @return string |
||
76 | */ |
||
77 | 4 | public function getAttributeName() : string |
|
81 | |||
82 | /** |
||
83 | * @return null|Relation |
||
84 | */ |
||
85 | 3 | public function getRelation() : ? Relation |
|
89 | |||
90 | /** |
||
91 | * @param ColumnFormatter $columnFormatter |
||
92 | * @return Column |
||
93 | */ |
||
94 | 2 | public function setFormatter(ColumnFormatter $columnFormatter) : Column |
|
100 | |||
101 | /** |
||
102 | * Get the formatted column value. |
||
103 | * |
||
104 | * @param Model $rowModel |
||
105 | * @return string |
||
106 | */ |
||
107 | 33 | public function getFormattedValue(Model $rowModel) : string |
|
113 | |||
114 | /** |
||
115 | * Get the value of this column for the given row. |
||
116 | * |
||
117 | * @param Model $rowModel |
||
118 | * @return string |
||
119 | */ |
||
120 | 33 | public function getValue(Model $rowModel) : string |
|
129 | |||
130 | /** |
||
131 | * Get the value from the column's relation |
||
132 | * |
||
133 | * @param Model $rowModel |
||
134 | * @return string |
||
135 | */ |
||
136 | 3 | private function _getValueFromRelation(Model $rowModel) : string |
|
146 | |||
147 | /** |
||
148 | * @param Model $rowModel |
||
149 | * @return string |
||
150 | */ |
||
151 | 33 | private function _getValue(Model $rowModel) : string |
|
155 | } |
||
156 |