Merge branch 4.5 into master
[civicrm-core.git] / CRM / Import / Parser.php
index a9042ba7afe62c83b7f27cb7526cad51c3c48e72..31c1d63d640ca5e44d04e3f5a4c72a3d35e024f8 100644 (file)
@@ -23,7 +23,7 @@
  | GNU Affero General Public License or the licensing of CiviCRM,     |
  | see the CiviCRM license FAQ at http://civicrm.org/licensing        |
  +--------------------------------------------------------------------+
-*/
+ */
 
 /**
  *
@@ -32,8 +32,6 @@
  * $Id$
  *
  */
-
-
 abstract class CRM_Import_Parser {
   /**
    * Settings
@@ -188,41 +186,41 @@ abstract class CRM_Import_Parser {
   /**
    * Class constructor
    */
-  function __construct() {
+  public function __construct() {
     $this->_maxLinesToProcess = 0;
     $this->_maxErrorCount = self::MAX_ERRORS;
   }
 
   /**
-   * Abstract function definitions
+   * Abstract function definitions.
    */
-  abstract function init();
+  abstract protected function init();
 
   /**
    * @return mixed
    */
-  abstract function fini();
+  abstract protected function fini();
 
   /**
    * @param $values
    *
    * @return mixed
    */
-  abstract function mapField(&$values);
+  abstract protected function mapField(&$values);
 
   /**
    * @param $values
    *
    * @return mixed
    */
-  abstract function preview(&$values);
+  abstract protected function preview(&$values);
 
   /**
    * @param $values
    *
    * @return mixed
    */
-  abstract function summary(&$values);
+  abstract protected function summary(&$values);
 
   /**
    * @param $onDuplicate
@@ -230,17 +228,19 @@ abstract class CRM_Import_Parser {
    *
    * @return mixed
    */
-  abstract function import($onDuplicate, &$values);
+  abstract protected function import($onDuplicate, &$values);
 
   /**
-   * Set and validate field values
+   * Set and validate field values.
    *
-   * @param $elements : array
-   * @param $erroneousField : reference
+   * @param array $elements
+   *   array.
+   * @param $erroneousField
+   *   reference.
    *
    * @return int
    */
-  function setActiveFieldValues($elements, &$erroneousField) {
+  public function setActiveFieldValues($elements, &$erroneousField) {
     $maxCount = count($elements) < $this->_activeFieldCount ? count($elements) : $this->_activeFieldCount;
     for ($i = 0; $i < $maxCount; $i++) {
       $this->_activeFields[$i]->setValue($elements[$i]);
@@ -265,12 +265,12 @@ abstract class CRM_Import_Parser {
   }
 
   /**
-   * Format the field values for input to the api
+   * Format the field values for input to the api.
    *
-   * @return array (reference) associative array of name/value pairs
-   * @access public
+   * @return array
+   *   (reference) associative array of name/value pairs
    */
-  function &getActiveFieldParams() {
+  public function &getActiveFieldParams() {
     $params = array();
     for ($i = 0; $i < $this->_activeFieldCount; $i++) {
       if (isset($this->_activeFields[$i]->_value)
@@ -287,7 +287,7 @@ abstract class CRM_Import_Parser {
   /**
    * @return array
    */
-  function getSelectValues() {
+  public function getSelectValues() {
     $values = array();
     foreach ($this->_fields as $name => $field) {
       $values[$name] = $field->_title;
@@ -298,7 +298,7 @@ abstract class CRM_Import_Parser {
   /**
    * @return array
    */
-  function getSelectTypes() {
+  public function getSelectTypes() {
     $values = array();
     foreach ($this->_fields as $name => $field) {
       if (isset($field->_hasLocationType)) {
@@ -311,7 +311,7 @@ abstract class CRM_Import_Parser {
   /**
    * @return array
    */
-  function getHeaderPatterns() {
+  public function getHeaderPatterns() {
     $values = array();
     foreach ($this->_fields as $name => $field) {
       if (isset($field->_headerPattern)) {
@@ -324,7 +324,7 @@ abstract class CRM_Import_Parser {
   /**
    * @return array
    */
-  function getDataPatterns() {
+  public function getDataPatterns() {
     $values = array();
     foreach ($this->_fields as $name => $field) {
       $values[$name] = $field->_dataPattern;
@@ -339,10 +339,8 @@ abstract class CRM_Import_Parser {
    * @param string $enclosure
    *
    * @return void
-   * @static
-   * @access public
    */
-  static function encloseScrub(&$values, $enclosure = "'") {
+  public static function encloseScrub(&$values, $enclosure = "'") {
     if (empty($values)) {
       return;
     }
@@ -353,25 +351,23 @@ abstract class CRM_Import_Parser {
   }
 
   /**
-   * Setter function
+   * Setter function.
    *
    * @param int $max
    *
    * @return void
-   * @access public
    */
-  function setMaxLinesToProcess($max) {
+  public function setMaxLinesToProcess($max) {
     $this->_maxLinesToProcess = $max;
   }
 
   /**
-   * Determines the file extension based on error code
+   * Determines the file extension based on error code.
    *
    * @var $type error code constant
    * @return string
-   * @static
    */
-  static function errorFileName($type) {
+  public static function errorFileName($type) {
     $fileName = NULL;
     if (empty($type)) {
       return $fileName;
@@ -405,13 +401,12 @@ abstract class CRM_Import_Parser {
   }
 
   /**
-   * Determines the file name based on error code
+   * Determines the file name based on error code.
    *
    * @var $type error code constant
    * @return string
-   * @static
    */
-  static function saveFileName($type) {
+  public static function saveFileName($type) {
     $fileName = NULL;
     if (empty($type)) {
       return $fileName;