* @param list > $rows * @param array $reportMap * @throws Exception */
(string $uid, array $rows, array $reportMap)
| 306 | * @throws Exception |
| 307 | */ |
| 308 | private function importThresholds(string $uid, array $rows, array $reportMap): void { |
| 309 | foreach ($rows as $row) { |
| 310 | $oldReport = isset($row['report']) ? (int)$row['report'] : 0; |
| 311 | $newReport = $reportMap[$oldReport] ?? null; |
| 312 | if ($newReport === null) { |
| 313 | continue; |
| 314 | } |
| 315 | |
| 316 | $this->insertAndReturnId('analytics_threshold', [ |
| 317 | 'user_id' => $uid, |
| 318 | 'report' => $newReport, |
| 319 | 'dimension' => $this->normalizeNullableInt($row['dimension'] ?? null), |
| 320 | 'target' => $row['target'] ?? 0, |
| 321 | 'option' => $row['option'] ?? '', |
| 322 | 'severity' => isset($row['severity']) ? (int)$row['severity'] : 0, |
| 323 | 'coloring' => $row['coloring'] ?? 'row', |
| 324 | 'sequence' => isset($row['sequence']) ? (int)$row['sequence'] : 1, |
| 325 | ]); |
| 326 | } |
| 327 | } |
| 328 | |
| 329 | /** |
| 330 | * Keep nullable integer fields nullable during import instead of coercing them to empty strings. |
no test coverage detected