QA fixes
[civicrm-core.git] / CRM / Import / Parser.php
index b6b6603096de705862520d0ff4619b7d2fe85d1d..d506c725b7a0288e5cf6d66e62ef333cf57e3a17 100644 (file)
@@ -1,9 +1,9 @@
 <?php
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.4                                                |
+ | CiviCRM version 4.5                                                |
  +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2013                                |
+ | Copyright CiviCRM LLC (c) 2004-2014                                |
  +--------------------------------------------------------------------+
  | This file is a part of CiviCRM.                                    |
  |                                                                    |
@@ -28,7 +28,7 @@
 /**
  *
  * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2013
+ * @copyright CiviCRM LLC (c) 2004-2014
  * $Id$
  *
  */
@@ -62,81 +62,81 @@ abstract class CRM_Import_Parser {
 
 
   /**
-   * total number of non empty lines
+   * Total number of non empty lines
    */
   protected $_totalCount;
 
   /**
-   * running total number of valid lines
+   * Running total number of valid lines
    */
   protected $_validCount;
 
   /**
-   * running total number of invalid rows
+   * Running total number of invalid rows
    */
   protected $_invalidRowCount;
 
   /**
-   * maximum number of non-empty/comment lines to process
+   * Maximum number of non-empty/comment lines to process
    *
    * @var int
    */
   protected $_maxLinesToProcess;
 
   /**
-   * maximum number of invalid rows to store
+   * Maximum number of invalid rows to store
    */
   protected $_maxErrorCount;
 
   /**
-   * array of error lines, bounded by MAX_ERROR
+   * Array of error lines, bounded by MAX_ERROR
    */
   protected $_errors;
 
   /**
-   * total number of conflict lines
+   * Total number of conflict lines
    */
   protected $_conflictCount;
 
   /**
-   * array of conflict lines
+   * Array of conflict lines
    */
   protected $_conflicts;
 
   /**
-   * total number of duplicate (from database) lines
+   * Total number of duplicate (from database) lines
    */
   protected $_duplicateCount;
 
   /**
-   * array of duplicate lines
+   * Array of duplicate lines
    */
   protected $_duplicates;
 
   /**
-   * running total number of warnings
+   * Running total number of warnings
    */
   protected $_warningCount;
 
   /**
-   * maximum number of warnings to store
+   * Maximum number of warnings to store
    */
   protected $_maxWarningCount = self::MAX_WARNINGS;
 
   /**
-   * array of warning lines, bounded by MAX_WARNING
+   * Array of warning lines, bounded by MAX_WARNING
    */
   protected $_warnings;
 
   /**
-   * array of all the fields that could potentially be part
+   * Array of all the fields that could potentially be part
    * of this import process
    * @var array
    */
   protected $_fields;
 
   /**
-   * array of the fields that are actually part of the import process
+   * Array of the fields that are actually part of the import process
    * the position in the array also dictates their position in the import
    * file
    * @var array
@@ -144,42 +144,42 @@ abstract class CRM_Import_Parser {
   protected $_activeFields;
 
   /**
-   * cache the count of active fields
+   * Cache the count of active fields
    *
    * @var int
    */
   protected $_activeFieldCount;
 
   /**
-   * cache of preview rows
+   * Cache of preview rows
    *
    * @var array
    */
   protected $_rows;
 
   /**
-   * filename of error data
+   * Filename of error data
    *
    * @var string
    */
   protected $_errorFileName;
 
   /**
-   * filename of conflict data
+   * Filename of conflict data
    *
    * @var string
    */
   protected $_conflictFileName;
 
   /**
-   * filename of duplicate data
+   * Filename of duplicate data
    *
    * @var string
    */
   protected $_duplicateFileName;
 
   /**
-   * contact type
+   * Contact type
    *
    * @var int
    */
@@ -197,17 +197,48 @@ abstract class CRM_Import_Parser {
    * Abstract function definitions
    */
   abstract function init();
+
+  /**
+   * @return mixed
+   */
   abstract function fini();
+
+  /**
+   * @param $values
+   *
+   * @return mixed
+   */
   abstract function mapField(&$values);
+
+  /**
+   * @param $values
+   *
+   * @return mixed
+   */
   abstract function preview(&$values);
+
+  /**
+   * @param $values
+   *
+   * @return mixed
+   */
   abstract function summary(&$values);
+
+  /**
+   * @param $onDuplicate
+   * @param $values
+   *
+   * @return mixed
+   */
   abstract function import($onDuplicate, &$values);
 
   /**
    * Set and validate field values
    *
-   * @param $elements: array
-   * @param $erroneousField: reference
+   * @param $elements : array
+   * @param $erroneousField : reference
+   *
+   * @return int
    */
   function setActiveFieldValues($elements, &$erroneousField) {
     $maxCount = count($elements) < $this->_activeFieldCount ? count($elements) : $this->_activeFieldCount;
@@ -253,6 +284,9 @@ abstract class CRM_Import_Parser {
     return $params;
   }
 
+  /**
+   * @return array
+   */
   function getSelectValues() {
     $values = array();
     foreach ($this->_fields as $name => $field) {
@@ -261,6 +295,9 @@ abstract class CRM_Import_Parser {
     return $values;
   }
 
+  /**
+   * @return array
+   */
   function getSelectTypes() {
     $values = array();
     foreach ($this->_fields as $name => $field) {
@@ -271,6 +308,9 @@ abstract class CRM_Import_Parser {
     return $values;
   }
 
+  /**
+   * @return array
+   */
   function getHeaderPatterns() {
     $values = array();
     foreach ($this->_fields as $name => $field) {
@@ -281,6 +321,9 @@ abstract class CRM_Import_Parser {
     return $values;
   }
 
+  /**
+   * @return array
+   */
   function getDataPatterns() {
     $values = array();
     foreach ($this->_fields as $name => $field) {
@@ -310,7 +353,7 @@ abstract class CRM_Import_Parser {
   }
 
   /**
-   * setter function
+   * Setter function
    *
    * @param int $max
    *