codespell: CRM/*
[civicrm-core.git] / CRM / Core / BAO / Tag.php
index 3fb43ecee8ee8dee4ea5cb3a631fc14a4f32b01f..9d7e976b29d01ffa0bef30ea04a846e64d7acc2a 100644 (file)
@@ -3,7 +3,7 @@
  +--------------------------------------------------------------------+
  | CiviCRM version 4.6                                                |
  +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2014                                |
+ | Copyright CiviCRM LLC (c) 2004-2015                                |
  +--------------------------------------------------------------------+
  | This file is a part of CiviCRM.                                    |
  |                                                                    |
  | GNU Affero General Public License or the licensing of CiviCRM,     |
  | see the CiviCRM license FAQ at http://civicrm.org/licensing        |
  +--------------------------------------------------------------------+
-*/
+ */
 
 /**
  *
  * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2014
+ * @copyright CiviCRM LLC (c) 2004-2015
  * $Id$
  *
  */
 class CRM_Core_BAO_Tag extends CRM_Core_DAO_Tag {
 
   /**
-   * Class constructor
+   * Class constructor.
    */
   public function __construct() {
     parent::__construct();
   }
 
   /**
-   * Fetch object based on array of properties
+   * Fetch object based on array of properties.
    *
    * @param array $params
    *   (reference ) an assoc array of name/value pairs.
@@ -51,7 +51,6 @@ class CRM_Core_BAO_Tag extends CRM_Core_DAO_Tag {
    *
    * @return object
    *   CRM_Core_DAO_Tag object on success, otherwise null
-   * @static
    */
   public static function retrieve(&$params, &$defaults) {
     $tag = new CRM_Core_DAO_Tag();
@@ -127,12 +126,11 @@ class CRM_Core_BAO_Tag extends CRM_Core_DAO_Tag {
    *
    * @return array
    */
-  public static function getTagsUsedFor($usedFor = array(
-      'civicrm_contact'
-    ),
-                                        $buildSelect = TRUE,
-                                        $all = FALSE,
-                                        $parentId = NULL
+  public static function getTagsUsedFor(
+    $usedFor = array('civicrm_contact'),
+    $buildSelect = TRUE,
+    $all = FALSE,
+    $parentId = NULL
   ) {
     $tags = array();
 
@@ -183,7 +181,7 @@ class CRM_Core_BAO_Tag extends CRM_Core_DAO_Tag {
   }
 
   /**
-   * Function to retrieve tags
+   * Function to retrieve tags.
    *
    * @param string $usedFor
    *   Which type of tag entity.
@@ -199,7 +197,7 @@ class CRM_Core_BAO_Tag extends CRM_Core_DAO_Tag {
    *
    * @return array
    */
-  static function getTags(
+  public static function getTags(
     $usedFor = 'civicrm_contact',
     &$tags = array(),
     $parentId = NULL,
@@ -210,10 +208,10 @@ class CRM_Core_BAO_Tag extends CRM_Core_DAO_Tag {
       $tags = array();
     }
     // We need to build a list of tags ordered by hierarchy and sorted by
-    // name. The heirarchy will be communicated by an accumulation of
+    // name. The hierarchy will be communicated by an accumulation of
     // separators in front of the name to give it a visual offset.
     // Instead of recursively making mysql queries, we'll make one big
-    // query and build the heirarchy with the algorithm below.
+    // query and build the hierarchy with the algorithm below.
     $args = array(1 => array('%' . $usedFor . '%', 'String'));
     $query = "SELECT id, name, parent_id, is_tagset, is_selectable
                   FROM civicrm_tag
@@ -316,17 +314,16 @@ class CRM_Core_BAO_Tag extends CRM_Core_DAO_Tag {
   }
 
   /**
-   * Delete the tag
+   * Delete the tag.
    *
    * @param int $id
    *   Tag id.
    *
-   * @return boolean
-   * @static
+   * @return bool
    */
   public static function del($id) {
     // since this is a destructive operation, lets make sure
-    // id is a postive number
+    // id is a positive number
     CRM_Utils_Type::validate($id, 'Positive');
 
     // delete all crm_entity_tag records with the selected tag id
@@ -348,7 +345,7 @@ class CRM_Core_BAO_Tag extends CRM_Core_DAO_Tag {
   }
 
   /**
-   * Takes an associative array and creates a contact object
+   * Takes an associative array and creates a contact object.
    *
    * The function extract all the params it needs to initialize the create a
    * contact object. the params array could contain additional unused name/value
@@ -362,7 +359,6 @@ class CRM_Core_BAO_Tag extends CRM_Core_DAO_Tag {
    *
    * @return object
    *   CRM_Core_DAO_Tag object on success, otherwise null
-   * @static
    */
   public static function add(&$params, $ids = array()) {
     $id = CRM_Utils_Array::value('id', $params, CRM_Utils_Array::value('tag', $ids));
@@ -407,13 +403,12 @@ class CRM_Core_BAO_Tag extends CRM_Core_DAO_Tag {
   }
 
   /**
-   * Check if there is data to create the object
+   * Check if there is data to create the object.
    *
    * @param array $params
    *   (reference ) an assoc array of name/value pairs.
    *
-   * @return boolean
-   * @static
+   * @return bool
    */
   public static function dataExists(&$params) {
     // Disallow empty values except for the number zero.
@@ -426,14 +421,13 @@ class CRM_Core_BAO_Tag extends CRM_Core_DAO_Tag {
   }
 
   /**
-   * Get the tag sets for a entity object
+   * Get the tag sets for a entity object.
    *
    * @param string $entityTable
    *   Entity_table.
    *
    * @return array
    *   array of tag sets
-   * @static
    */
   public static function getTagSet($entityTable) {
     $tagSets = array();
@@ -442,8 +436,8 @@ class CRM_Core_BAO_Tag extends CRM_Core_DAO_Tag {
     $dao = CRM_Core_DAO::executeQuery($query, array(
         1 => array(
           '%' . $entityTable . '%',
-          'String'
-        )
+          'String',
+        ),
       ), TRUE, NULL, FALSE, FALSE);
     while ($dao->fetch()) {
       $tagSets[$dao->id] = $dao->name;
@@ -457,8 +451,6 @@ class CRM_Core_BAO_Tag extends CRM_Core_DAO_Tag {
    *
    * @return array
    *   associated array of tag name and id
-   * @access public
-   * @static
    */
   public static function getTagsNotInTagset() {
     $tags = $tagSets = array();
@@ -483,4 +475,5 @@ class CRM_Core_BAO_Tag extends CRM_Core_DAO_Tag {
 
     return $tags;
   }
+
 }