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

Method read

lib/Service/ReportService.php:140–171  ·  view source on GitHub ↗

* get own report details * * @param int $reportId * @return array * @throws Exception */

(int $reportId, $replace = true)

Source from the content-addressed store, hash-verified

138 * @throws Exception
139 */
140 public function read(int $reportId, $replace = true) {
141 $ownReport = $this->ReportMapper->readOwn($reportId);
142 if (!empty($ownReport)) {
143 if ((int)$ownReport['type'] === DatasourceController::DATASET_TYPE_INTERNAL_DB) {
144 if ((int)$ownReport['dataset'] <= 0
145 || empty($this->DatasetService->readOwn((int)$ownReport['dataset']))) {
146 return [];
147 }
148 } else if ((int)$ownReport['dataset'] !== 0) {
149 return [];
150 }
151 }
152 if (!empty($ownReport)) {
153 $ownReport['permissions'] = \OCP\Constants::PERMISSION_UPDATE;
154 if ($replace) $ownReport = $this->VariableService->replaceTextVariables($ownReport);
155
156 if ($ownReport['type'] === DatasourceController::DATASET_TYPE_INTERNAL_DB && $ownReport['dataset'] !== 0) {
157 $dataset = $this->DatasetService->readOwn($ownReport['dataset']);
158 $ownReport['storageMode'] = $dataset['storageMode'] ?? 'legacy';
159 $ownReport['schemaVersion'] = (int)($dataset['schemaVersion'] ?? 0);
160 if ($ownReport['storageMode'] === 'flexible_shared') {
161 $ownReport['columns'] = $dataset['columns'] ?? [];
162 } else {
163 $ownReport['dimension1'] = $dataset['dimension1'];
164 $ownReport['dimension2'] = $dataset['dimension2'];
165 $ownReport['value'] = $dataset['value'];
166 }
167 }
168
169 }
170 return $ownReport;
171 }
172
173 /** Return only an owned report with an owned internal dataset. */
174 public function readOwnDatasetReport(int $reportId): array {

Callers 1

exportMethod · 0.45

Calls 2

replaceTextVariablesMethod · 0.80
readOwnMethod · 0.45

Tested by

no test coverage detected