From 4ecdb5103b50ce4c66aaf508cba6b82d360ac800 Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Mon, 26 Sep 2022 15:26:38 +1300 Subject: [PATCH] [REF] Extract validateRow --- CRM/Import/Parser.php | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/CRM/Import/Parser.php b/CRM/Import/Parser.php index 65eba6fdf1..22a14bcafa 100644 --- a/CRM/Import/Parser.php +++ b/CRM/Import/Parser.php @@ -1820,15 +1820,7 @@ abstract class CRM_Import_Parser implements UserJobInterface { public function validate(): void { $dataSource = $this->getDataSourceObject(); while ($row = $dataSource->getRow()) { - try { - $rowNumber = $row['_id']; - $values = array_values($row); - $this->validateValues($values); - $this->setImportStatus($rowNumber, 'VALID', ''); - } - catch (CRM_Core_Exception $e) { - $this->setImportStatus($rowNumber, 'ERROR', $e->getMessage()); - } + $this->validateRow($row); } } @@ -2551,4 +2543,19 @@ abstract class CRM_Import_Parser implements UserJobInterface { return $dedupeRules; } + /** + * @param array|null $row + */ + public function validateRow(?array $row): void { + try { + $rowNumber = $row['_id']; + $values = array_values($row); + $this->validateValues($values); + $this->setImportStatus($rowNumber, 'VALID', ''); + } + catch (CRM_Core_Exception $e) { + $this->setImportStatus($rowNumber, 'ERROR', $e->getMessage()); + } + } + } -- 2.25.1