1 | <?php |
||
47 | class ActiveHighstockWidget extends HighstockWidget |
||
48 | { |
||
49 | /** |
||
50 | * Pass in a data provider that we will turn into the series |
||
51 | * |
||
52 | * @var CDataProvider |
||
53 | */ |
||
54 | public $dataProvider; |
||
55 | |||
56 | public function run() |
||
90 | |||
91 | /** |
||
92 | * Checks whether we want to remove null values from a series |
||
93 | * |
||
94 | * @param $series |
||
95 | * @param $row |
||
96 | * |
||
97 | * @return bool |
||
98 | */ |
||
99 | private function shouldRemoveNullValues($series, $row) |
||
109 | |||
110 | /** |
||
111 | * Handles processing a row and readying it for Highstock |
||
112 | * |
||
113 | * @param $row |
||
114 | * @param $batch |
||
115 | * @throws Exception |
||
116 | * @return array |
||
117 | */ |
||
118 | protected function processRow($row, $batch) |
||
151 | |||
152 | /** |
||
153 | * Cleans up the data column so Highstock is happy |
||
154 | * |
||
155 | * @param $row |
||
156 | * @param $batch |
||
157 | * @return array |
||
158 | */ |
||
159 | protected function processData($row, $batch) |
||
171 | |||
172 | /** |
||
173 | * Using this means your time needs to be in JS milliseconds |
||
174 | * |
||
175 | * @param $row |
||
176 | * @param $batch |
||
177 | * @return array |
||
178 | */ |
||
179 | protected function processPlainTimestamp($row, $batch) |
||
183 | |||
184 | /** |
||
185 | * Converts dates using strtotime() to a MySQL timestamp and then changes to JS milliseconds |
||
186 | * |
||
187 | * @param $row |
||
188 | * @param $batch |
||
189 | * @return array |
||
190 | */ |
||
191 | protected function processDateString($row, $batch) |
||
195 | |||
196 | /** |
||
197 | * Converts a SQL unix timestamp to a JS timestamp (in milliseconds) |
||
198 | * This is our default time processor if not specified |
||
199 | * |
||
200 | * @param $row |
||
201 | * @param $batch |
||
202 | * @return array |
||
203 | */ |
||
204 | protected function processMysqlTimestamp($row, $batch) |
||
208 | |||
209 | /** |
||
210 | * Sorts our date series so we have all the dates from first to last |
||
211 | * |
||
212 | * @param $series |
||
213 | */ |
||
214 | protected function sortDateSeries(&$series) |
||
224 | |||
225 | /** |
||
226 | * Highstocks won't graph a value if we have a null for it. |
||
227 | * We want to make sure we don't cast nulls to 0 using floatval, |
||
228 | * so we check here to make sure the value should be converted to |
||
229 | * a float before we do anything. |
||
230 | * |
||
231 | * @param $value |
||
232 | * @return float|null |
||
233 | */ |
||
234 | protected function processDataValue($value) |
||
238 | } |
||
239 |
The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.
The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.
To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.