MCPcopy Create free account
hub / github.com/Rello/analytics / readPreview

Method readPreview

lib/Controller/OutputController.php:243–262  ·  view source on GitHub ↗

* Preview the data * * @param $type * @param $options * @return DataResponse|NotFoundResponse * @throws Exception */

($type, $options)

Source from the content-addressed store, hash-verified

241 * @throws Exception
242 */
243 #[NoAdminRequired]
244 public function readPreview($type, $options) {
245 $reportMetadata = [];
246 $array = json_decode($options, true);
247 foreach ($array as $key => $value) {
248 $array[$key] = htmlspecialchars($value, ENT_NOQUOTES, 'UTF-8');
249 }
250 $reportMetadata['link'] = json_encode($array);
251 $reportMetadata['type'] = $type;
252 $reportMetadata['dataset'] = 0;
253 $reportMetadata['filteroptions'] = '';
254 $reportMetadata['user_id'] = $this->userId;
255 $reportMetadata['id'] = 0;
256
257 $result = $this->getData($reportMetadata);
258 unset($result['options'], $result['dimensions'], $result['filterApplied'], $result['thresholds']);
259 $result['data'] = array_slice($result['data'], 0, 1);
260
261 return new DataResponse($result, HTTP::STATUS_OK);
262 }
263
264
265 /**

Callers

nothing calls this directly

Calls 1

getDataMethod · 0.95

Tested by

no test coverage detected