1 | <?php |
||
10 | class Row |
||
11 | { |
||
12 | /** |
||
13 | * Row number. |
||
14 | * |
||
15 | * @var |
||
16 | */ |
||
17 | public $number; |
||
18 | |||
19 | /** |
||
20 | * Row data. |
||
21 | * |
||
22 | * @var |
||
23 | */ |
||
24 | protected $data; |
||
25 | |||
26 | /** |
||
27 | * Attributes of row. |
||
28 | * |
||
29 | * @var array |
||
30 | */ |
||
31 | protected $attributes = []; |
||
32 | |||
33 | /** |
||
34 | * Constructor. |
||
35 | * |
||
36 | * @param $number |
||
37 | * @param $data |
||
38 | */ |
||
39 | public function __construct($number, $data) |
||
45 | |||
46 | /** |
||
47 | * Get the value of the model's primary key. |
||
48 | * |
||
49 | * @return mixed |
||
50 | */ |
||
51 | public function getKey() |
||
55 | |||
56 | /** |
||
57 | * Get attributes in html format. |
||
58 | * |
||
59 | * @return string |
||
60 | */ |
||
61 | public function getRowAttributes() |
||
65 | |||
66 | /** |
||
67 | * Get column attributes. |
||
68 | * |
||
69 | * @param string $column |
||
70 | * |
||
71 | * @return string |
||
72 | */ |
||
73 | public function getColumnAttributes($column) |
||
81 | |||
82 | /** |
||
83 | * Format attributes to html. |
||
84 | * |
||
85 | * @param array $attributes |
||
86 | * |
||
87 | * @return string |
||
88 | */ |
||
89 | private function formatHtmlAttribute($attributes = []) |
||
98 | |||
99 | /** |
||
100 | * Set attributes. |
||
101 | * |
||
102 | * @param array $attributes |
||
103 | */ |
||
104 | public function setAttributes(array $attributes) |
||
108 | |||
109 | /** |
||
110 | * Set style of the row. |
||
111 | * |
||
112 | * @param array|string $style |
||
113 | */ |
||
114 | public function style($style) |
||
126 | |||
127 | /** |
||
128 | * Get data of this row. |
||
129 | * |
||
130 | * @return mixed |
||
131 | */ |
||
132 | public function model() |
||
136 | |||
137 | /** |
||
138 | * Getter. |
||
139 | * |
||
140 | * @param mixed $attr |
||
141 | * |
||
142 | * @return mixed |
||
143 | */ |
||
144 | public function __get($attr) |
||
148 | |||
149 | /** |
||
150 | * Get or set value of column in this row. |
||
151 | * |
||
152 | * @param string $name |
||
153 | * @param mixed $value |
||
154 | * |
||
155 | * @return $this|mixed |
||
156 | */ |
||
157 | public function column($name, $value = null) |
||
173 | |||
174 | /** |
||
175 | * Output column value. |
||
176 | * |
||
177 | * @param mixed $value |
||
178 | * |
||
179 | * @return mixed|string |
||
180 | */ |
||
181 | protected function output($value) |
||
201 | } |
||
202 |
Since your code implements the magic getter
_get
, this function will be called for any read access on an undefined variable. You can add the@property
annotation to your class or interface to document the existence of this variable.If the property has read access only, you can use the @property-read annotation instead.
Of course, you may also just have mistyped another name, in which case you should fix the error.
See also the PhpDoc documentation for @property.