INFRA-132 - Comment grammar cleanup
[civicrm-core.git] / CRM / Core / BAO / SchemaHandler.php
index 1853aa61d1fd42e751b9223c51e47ba5537ab4bc..4fa3c4dc1d6df8cb4016c1bf90624836757e090f 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.5                                                |
+ | CiviCRM version 4.6                                                |
  +--------------------------------------------------------------------+
  | Copyright CiviCRM LLC (c) 2004-2014                                |
  +--------------------------------------------------------------------+
@@ -51,7 +51,7 @@
  *                                             'class'         => FIELD_CLASS_TYPE,
  *                                             'primary'       => BOOLEAN,
  *                                             'required'      => BOOLEAN,
- *                                             'searchable'    => true,
+ *                                             'searchable'    => TRUE,
  *                                             'fk_table_name' => FOREIGN_KEY_TABLE_NAME,
  *                                             'fk_field_name' => FOREIGN_KEY_FIELD_NAME,
  *                                             'comment'       => COMMENT,
 class CRM_Core_BAO_SchemaHandler {
 
   /**
-   * Function for creating a civiCRM-table
+   * Create a CiviCRM-table
    *
-   * @param $params
+   * @param array $params
    *
-   * @internal param String $tableName name of the table to be created.
-   * @internal param Array $tableAttributes array containing atrributes for the table that needs to be created
-   *
-   * @return true if successfully created, false otherwise
+   * @return TRUE if successfully created, FALSE otherwise
    *
    * @static
-   * @access public
    */
-  static function createTable(&$params) {
+  public static function createTable(&$params) {
     $sql = self::buildTableSQL($params);
     // do not i18n-rewrite
     $dao = CRM_Core_DAO::executeQuery($sql, array(), TRUE, NULL, FALSE, FALSE);
@@ -84,7 +80,7 @@ class CRM_Core_BAO_SchemaHandler {
     if ($config->logging) {
       // logging support
       $logging = new CRM_Logging_Schema;
-      $logging->fixSchemaDifferencesFor($params['name'], null, FALSE);
+      $logging->fixSchemaDifferencesFor($params['name'], NULL, FALSE);
     }
 
     // always do a trigger rebuild for this table
@@ -94,11 +90,11 @@ class CRM_Core_BAO_SchemaHandler {
   }
 
   /**
-   * @param $params
+   * @param array $params
    *
    * @return string
    */
-  static function buildTableSQL(&$params) {
+  public static function buildTableSQL(&$params) {
     $sql = "CREATE TABLE {$params['name']} (";
     if (isset($params['fields']) &&
       is_array($params['fields'])
@@ -129,13 +125,13 @@ class CRM_Core_BAO_SchemaHandler {
   }
 
   /**
-   * @param $params
+   * @param array $params
    * @param $separator
    * @param $prefix
    *
    * @return string
    */
-  static function buildFieldSQL(&$params, $separator, $prefix) {
+  public static function buildFieldSQL(&$params, $separator, $prefix) {
     $sql = '';
     $sql .= $separator;
     $sql .= str_repeat(' ', 8);
@@ -164,13 +160,13 @@ class CRM_Core_BAO_SchemaHandler {
   }
 
   /**
-   * @param $params
+   * @param array $params
    * @param $separator
    * @param $prefix
    *
-   * @return null|string
+   * @return NULL|string
    */
-  static function buildPrimaryKeySQL(&$params, $separator, $prefix) {
+  public static function buildPrimaryKeySQL(&$params, $separator, $prefix) {
     $sql = NULL;
     if (!empty($params['primary'])) {
       $sql .= $separator;
@@ -182,14 +178,14 @@ class CRM_Core_BAO_SchemaHandler {
   }
 
   /**
-   * @param $params
+   * @param array $params
    * @param $separator
    * @param $prefix
    * @param bool $indexExist
    *
-   * @return null|string
+   * @return NULL|string
    */
-  static function buildSearchIndexSQL(&$params, $separator, $prefix, $indexExist = FALSE) {
+  public static function buildSearchIndexSQL(&$params, $separator, $prefix, $indexExist = FALSE) {
     $sql = NULL;
 
     // dont index blob
@@ -215,13 +211,13 @@ class CRM_Core_BAO_SchemaHandler {
   }
 
   /**
-   * @param $params
+   * @param array $params
    * @param $separator
    * @param $prefix
    *
    * @return string
    */
-  static function buildIndexSQL(&$params, $separator, $prefix) {
+  public static function buildIndexSQL(&$params, $separator, $prefix) {
     $sql = '';
     $sql .= $separator;
     $sql .= str_repeat(' ', 8);
@@ -248,12 +244,12 @@ class CRM_Core_BAO_SchemaHandler {
   }
 
   /**
-   * @param $tableName
-   * @param $fkTableName
+   * @param string $tableName
+   * @param string $fkTableName
    *
    * @return bool
    */
-  static function changeFKConstraint($tableName, $fkTableName) {
+  public static function changeFKConstraint($tableName, $fkTableName) {
     $fkName = "{$tableName}_entity_id";
     if (strlen($fkName) >= 48) {
       $fkName = substr($fkName, 0, 32) . "_" . substr(md5($fkName), 0, 16);
@@ -276,14 +272,14 @@ ALTER TABLE {$tableName}
   }
 
   /**
-   * @param $params
+   * @param array $params
    * @param $separator
    * @param $prefix
-   * @param $tableName
+   * @param string $tableName
    *
-   * @return null|string
+   * @return NULL|string
    */
-  static function buildForeignKeySQL(&$params, $separator, $prefix, $tableName) {
+  public static function buildForeignKeySQL(&$params, $separator, $prefix, $tableName) {
     $sql = NULL;
     if (!empty($params['fk_table_name']) && !empty($params['fk_field_name'])) {
       $sql .= $separator;
@@ -301,13 +297,13 @@ ALTER TABLE {$tableName}
   }
 
   /**
-   * @param $params
+   * @param array $params
    * @param bool $indexExist
    * @param bool $triggerRebuild
    *
    * @return bool
    */
-  static function alterFieldSQL(&$params, $indexExist = FALSE, $triggerRebuild = TRUE) {
+  public static function alterFieldSQL(&$params, $indexExist = FALSE, $triggerRebuild = TRUE) {
     $sql = str_repeat(' ', 8);
     $sql .= "ALTER TABLE {$params['table_name']}";
 
@@ -357,7 +353,7 @@ ALTER TABLE {$tableName}
       }
     }
 
-    if($triggerRebuild) {
+    if ($triggerRebuild) {
       CRM_Core_DAO::triggerRebuild($params['table_name']);
     }
 
@@ -365,34 +361,35 @@ ALTER TABLE {$tableName}
   }
 
   /**
-   * Function to delete a civiCRM-table
+   * Delete a civiCRM-table
    *
-   * @param  String  $tableName   name of the table to be created.
+   * @param string $tableName
+   *   Name of the table to be created.
    *
-   * @return true if successfully deleted, false otherwise
+   * @return bool
+   *   TRUE if successfully deleted, FALSE otherwise.
    *
    * @static
-   * @access public
    */
-  static function dropTable($tableName) {
+  public static function dropTable($tableName) {
     $sql = "DROP TABLE $tableName";
     $dao = CRM_Core_DAO::executeQuery($sql);
   }
 
   /**
-   * @param $tableName
-   * @param $columnName
+   * @param string $tableName
+   * @param string $columnName
    */
-  static function dropColumn($tableName, $columnName) {
+  public static function dropColumn($tableName, $columnName) {
     $sql = "ALTER TABLE $tableName DROP COLUMN $columnName";
     $dao = CRM_Core_DAO::executeQuery($sql);
   }
 
   /**
-   * @param $tableName
+   * @param string $tableName
    * @param bool $dropUnique
    */
-  static function changeUniqueToIndex($tableName, $dropUnique = TRUE) {
+  public static function changeUniqueToIndex($tableName, $dropUnique = TRUE) {
     if ($dropUnique) {
       $sql = "ALTER TABLE $tableName
 DROP INDEX `unique_entity_id` ,
@@ -411,11 +408,9 @@ ADD UNIQUE INDEX `unique_entity_id` ( `entity_id` )";
    * @param string $createIndexPrefix
    * @param array $substrLenghts
    */
-  static function createIndexes(&$tables, $createIndexPrefix = 'index', $substrLenghts = array(
-    )) {
+  public static function createIndexes(&$tables, $createIndexPrefix = 'index', $substrLenghts = array()) {
     $queries = array();
-
-        require_once 'CRM/Core/DAO/Domain.php';
+    require_once 'CRM/Core/DAO/Domain.php';
     $domain = new CRM_Core_DAO_Domain;
     $domain->find(TRUE);
     $locales = explode(CRM_Core_DAO::VALUE_SEPARATOR, $domain->locales);
@@ -473,14 +468,14 @@ ADD UNIQUE INDEX `unique_entity_id` ( `entity_id` )";
   }
 
   /**
-   * @param $customFieldID
-   * @param $tableName
-   * @param $columnName
+   * @param int $customFieldID
+   * @param string $tableName
+   * @param string $columnName
    * @param $length
    *
    * @throws Exception
    */
-  static function alterFieldLength($customFieldID, $tableName, $columnName, $length) {
+  public static function alterFieldLength($customFieldID, $tableName, $columnName, $length) {
     // first update the custom field tables
     $sql = "
 UPDATE civicrm_custom_field
@@ -522,10 +517,9 @@ MODIFY      {$columnName} varchar( $length )
           array(
             1 => $tableName,
             2 => $columnName,
-            3 => $customFieldID
+            3 => $customFieldID,
           )
         ));
     }
   }
 }
-