INFRA-132 - CRM/Event - phpcbf
[civicrm-core.git] / CRM / Contact / Import / ImportJob.php
index f633c2c75c844b1af9889fc8854cece50bb7a9c8..a9264e1d7c161baad725de2f5e7b0ee93c7187f7 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.5                                                |
+ | CiviCRM version 4.6                                                |
  +--------------------------------------------------------------------+
  | Copyright CiviCRM LLC (c) 2004-2014                                |
  +--------------------------------------------------------------------+
@@ -73,6 +73,13 @@ class CRM_Contact_Import_ImportJob {
 
   protected $_parser;
 
+  /**
+   * @param null $tableName
+   * @param null $createSql
+   * @param bool $createTable
+   *
+   * @throws Exception
+   */
   public function __construct($tableName = NULL, $createSql = NULL, $createTable = FALSE) {
     $dao = new CRM_Core_DAO();
     $db = $dao->getDatabaseConnection();
@@ -111,13 +118,23 @@ class CRM_Contact_Import_ImportJob {
       'mapperRelatedContactImProvider',
       'mapperRelatedContactWebsiteType',
     );
-    foreach ($properties as $property) $this->{"_$property"} = array();
+    foreach ($properties as $property) { $this->{"_$property"} = array();
+    }
   }
 
+  /**
+   * @return null|string
+   */
   public function getTableName() {
     return $this->_tableName;
   }
 
+  /**
+   * @param bool $dropIfComplete
+   *
+   * @return bool
+   * @throws Exception
+   */
   public function isComplete($dropIfComplete = TRUE) {
     if (!$this->_statusFieldName) {
       CRM_Core_Error::fatal("Could not get name of the import status field");
@@ -135,6 +152,9 @@ class CRM_Contact_Import_ImportJob {
     return TRUE;
   }
 
+  /**
+   * @param array $params
+   */
   public function setJobParams(&$params) {
     foreach ($params as $param => $value) {
       $fldName = "_$param";
@@ -142,6 +162,10 @@ class CRM_Contact_Import_ImportJob {
     }
   }
 
+  /**
+   * @param CRM_Core_Form $form
+   * @param int $timeout
+   */
   public function runImport(&$form, $timeout = 55) {
     $mapper        = $this->_mapper;
     $mapperFields  = array();
@@ -167,7 +191,8 @@ class CRM_Contact_Import_ImportJob {
 
     foreach ($mapper as $key => $value) {
       //set respective mapper value to null.
-      foreach (array_values($mapperPeroperties) as $perpertyVal)$$perpertyVal = NULL;
+      foreach (array_values($mapperPeroperties) as $perpertyVal) { $$perpertyVal = NULL;
+      }
 
       $fldName = CRM_Utils_Array::value(0, $mapper[$key]);
       $header = array($this->_mapFields[$fldName]);
@@ -307,10 +332,20 @@ class CRM_Contact_Import_ImportJob {
     }
   }
 
+  /**
+   * @param $form
+   */
   public function setFormVariables($form) {
     $this->_parser->set($form, CRM_Import_Parser::MODE_IMPORT);
   }
 
+  /**
+   * @param $contactIds
+   * @param string $newGroupName
+   * @param $newGroupDesc
+   *
+   * @return array|bool
+   */
   private function _addImportedContactsToNewGroup($contactIds,
     $newGroupName, $newGroupDesc
   ) {
@@ -357,6 +392,13 @@ class CRM_Contact_Import_ImportJob {
     return FALSE;
   }
 
+  /**
+   * @param $contactIds
+   * @param string $newTagName
+   * @param $newTagDesc
+   *
+   * @return array|bool
+   */
   private function _tagImportedContactsWithNewTag($contactIds,
     $newTagName, $newTagDesc
   ) {
@@ -406,6 +448,9 @@ class CRM_Contact_Import_ImportJob {
     return FALSE;
   }
 
+  /**
+   * @return array
+   */
   public static function getIncompleteImportTables() {
     $dao      = new CRM_Core_DAO();
     $database = $dao->database();
@@ -423,4 +468,3 @@ class CRM_Contact_Import_ImportJob {
     return $incompleteImportTables;
   }
 }
-