Merge pull request #22264 from sunilpawar/dev_recurring_error
[civicrm-core.git] / CRM / Import / Parser.php
index 60ba7e8d5658dad8dba3f4cf4776448400a1b387..68ef35a23d8eddf214a3ca9ae4d6ebe6522bf5ac 100644 (file)
@@ -142,9 +142,10 @@ abstract class CRM_Import_Parser {
 
   /**
    * Set metadata for all importable fields in std getfields style format.
+   *
    * @param array $importableFieldsMetadata
    */
-  public function setImportableFieldsMetadata(array $importableFieldsMetadata) {
+  public function setImportableFieldsMetadata(array $importableFieldsMetadata): void {
     $this->importableFieldsMetadata = $importableFieldsMetadata;
   }
 
@@ -264,7 +265,7 @@ abstract class CRM_Import_Parser {
    *
    * @return int
    */
-  public function setActiveFieldValues($elements, &$erroneousField) {
+  public function setActiveFieldValues($elements, &$erroneousField = NULL) {
     $maxCount = count($elements) < $this->_activeFieldCount ? count($elements) : $this->_activeFieldCount;
     for ($i = 0; $i < $maxCount; $i++) {
       $this->_activeFields[$i]->setValue($elements[$i]);
@@ -316,7 +317,7 @@ abstract class CRM_Import_Parser {
    * @param bool $startImport
    *   True when progress bar is to be initiated.
    * @param $startTimestamp
-   *   Initial timstamp when the import was started.
+   *   Initial timestamp when the import was started.
    * @param $prevTimestamp
    *   Previous timestamp when this function was last called.
    * @param $totalRowCount
@@ -325,8 +326,7 @@ abstract class CRM_Import_Parser {
    * @return NULL|$currTimestamp
    */
   public function progressImport($statusID, $startImport = TRUE, $startTimestamp = NULL, $prevTimestamp = NULL, $totalRowCount = NULL) {
-    $config = CRM_Core_Config::singleton();
-    $statusFile = "{$config->uploadDir}status_{$statusID}.txt";
+    $statusFile = CRM_Core_Config::singleton()->uploadDir . "status_{$statusID}.txt";
 
     if ($startImport) {
       $status = "<div class='description'>&nbsp; " . ts('No processing status reported yet.') . "</div>";
@@ -337,7 +337,6 @@ abstract class CRM_Import_Parser {
     else {
       $rowCount = $this->_rowCount ?? $this->_lineCount;
       $currTimestamp = time();
-      $totalTime = ($currTimestamp - $startTimestamp);
       $time = ($currTimestamp - $prevTimestamp);
       $recordsLeft = $totalRowCount - $rowCount;
       if ($recordsLeft < 0) {
@@ -366,7 +365,7 @@ abstract class CRM_Import_Parser {
   /**
    * @return array
    */
-  public function getSelectValues() {
+  public function getSelectValues(): array {
     $values = [];
     foreach ($this->_fields as $name => $field) {
       $values[$name] = $field->_title;
@@ -443,7 +442,7 @@ abstract class CRM_Import_Parser {
   /**
    * Determines the file extension based on error code.
    *
-   * @var $type error code constant
+   * @var int $type error code constant
    * @return string
    */
   public static function errorFileName($type) {