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

Method read

lib/Service/ReportService.php:139–170  ·  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

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