CRM-15849: fix translation string, comments
[civicrm-core.git] / CRM / Contact / BAO / GroupNesting.php
index 172f9a6beeebdb333aecfac7b990d244dc16d04f..b065d4a1720cf4e3966c47cb43f3b3e4549d0e99 100644 (file)
@@ -24,7 +24,7 @@
  | GNU Affero General Public License or the licensing of CiviCRM,     |
  | see the CiviCRM license FAQ at http://civicrm.org/licensing        |
  +--------------------------------------------------------------------+
-*/
+ */
 
 /**
  *
@@ -105,14 +105,17 @@ class CRM_Contact_BAO_GroupNesting extends CRM_Contact_DAO_GroupNesting implemen
     $this->_alreadyStyled = FALSE;
   }
 
+  /**
+   * @return mixed
+   */
   public function current() {
     if ($this->_styleLabels &&
       $this->valid() &&
       !$this->_alreadyStyled
     ) {
-      $styledGroup  = clone($this->_current);
+      $styledGroup = clone($this->_current);
       $nestingLevel = $this->getCurrentNestingLevel();
-      $indent       = '';
+      $indent = '';
       while ($nestingLevel--) {
         $indent .= $this->_styleIndent;
       }
@@ -194,7 +197,7 @@ class CRM_Contact_BAO_GroupNesting extends CRM_Contact_DAO_GroupNesting implemen
    */
   public function _getNextParentlessGroup(&$group = NULL) {
     $lastParentlessGroup = $this->_lastParentlessGroup;
-    $nextGroup           = new CRM_Contact_BAO_Group();
+    $nextGroup = new CRM_Contact_BAO_Group();
     $nextGroup->order_by = 'title ' . self::$_sortOrder;
     $nextGroup->find();
     if ($group == NULL) {
@@ -259,10 +262,10 @@ class CRM_Contact_BAO_GroupNesting extends CRM_Contact_DAO_GroupNesting implemen
     }
     else {
       /* if we get here, it could be because we're out of siblings
-             * (in which case we return null) or because we're at the
-             * top level groups which do not have parents but may still
-             * have siblings, so check for that first.
-             */
+       * (in which case we return null) or because we're at the
+       * top level groups which do not have parents but may still
+       * have siblings, so check for that first.
+       */
 
       $nextGroup = $this->_getNextParentlessGroup($group);
       if ($nextGroup) {
@@ -302,8 +305,7 @@ class CRM_Contact_BAO_GroupNesting extends CRM_Contact_DAO_GroupNesting implemen
    * @param $childID
    *   The id of the child group being removed.
    *
-   * @return           void
-   *
+   * @return void
    */
   public static function remove($parentID, $childID) {
     $dao = new CRM_Contact_DAO_GroupNesting();
@@ -319,8 +321,7 @@ class CRM_Contact_BAO_GroupNesting extends CRM_Contact_DAO_GroupNesting implemen
    * @param int $childID
    *   The id of the child group being removed.
    *
-   * @return           void
-   *
+   * @return void
    */
   public static function removeAllParentForChild($childID) {
     $dao = new CRM_Contact_DAO_GroupNesting();
@@ -337,8 +338,8 @@ class CRM_Contact_BAO_GroupNesting extends CRM_Contact_DAO_GroupNesting implemen
    * @param $childID
    *   The child id of the association.
    *
-   * @return           boolean           True if association is found, false otherwise.
-   *
+   * @return bool
+   *   True if association is found, false otherwise.
    */
   public static function isParentChild($parentID, $childID) {
     $dao = new CRM_Contact_DAO_GroupNesting();
@@ -357,8 +358,8 @@ class CRM_Contact_BAO_GroupNesting extends CRM_Contact_DAO_GroupNesting implemen
    * @param $groupId
    *   The id of the group to check for child groups.
    *
-   * @return           boolean                True if 1 or more child groups are found, false otherwise.
-   *
+   * @return bool
+   *   True if 1 or more child groups are found, false otherwise.
    */
   public static function hasChildGroups($groupId) {
     $dao = new CRM_Contact_DAO_GroupNesting();
@@ -378,8 +379,8 @@ class CRM_Contact_BAO_GroupNesting extends CRM_Contact_DAO_GroupNesting implemen
    * @param $groupId
    *   The id of the group to check for parent groups.
    *
-   * @return           boolean                True if 1 or more parent groups are found, false otherwise.
-   *
+   * @return bool
+   *   True if 1 or more parent groups are found, false otherwise.
    */
   public static function hasParentGroups($groupId) {
     $dao = new CRM_Contact_DAO_GroupNesting();
@@ -395,13 +396,13 @@ class CRM_Contact_BAO_GroupNesting extends CRM_Contact_DAO_GroupNesting implemen
    * Returns true if checkGroupId is a parent of one of the groups in
    * groupIds, false otherwise.
    *
-   * @param $groupIds
-   *   Array of group ids (or one group id) to serve as the starting point.
+   * @param array $groupIds
+   *   of group ids (or one group id) to serve as the starting point.
    * @param $checkGroupId
    *   The group id to check if it is a parent of the $groupIds group(s).
    *
-   * @return           boolean                True if $checkGroupId points to a group that is a parent of one of the $groupIds groups, false otherwise.
-   *
+   * @return bool
+   *   True if $checkGroupId points to a group that is a parent of one of the $groupIds groups, false otherwise.
    */
   public static function isParentGroup($groupIds, $checkGroupId) {
     if (!is_array($groupIds)) {
@@ -414,8 +415,8 @@ class CRM_Contact_BAO_GroupNesting extends CRM_Contact_DAO_GroupNesting implemen
       $parentGroupId = $dao->parent_group_id;
       if ($parentGroupId == $checkGroupId) {
         /* print "One of these: <pre>";
-                print_r($groupIds);
-                print "</pre> has groupId $checkGroupId as an ancestor.<br/>"; */
+        print_r($groupIds);
+        print "</pre> has groupId $checkGroupId as an ancestor.<br/>"; */
 
         return TRUE;
       }
@@ -427,13 +428,13 @@ class CRM_Contact_BAO_GroupNesting extends CRM_Contact_DAO_GroupNesting implemen
    * Returns true if checkGroupId is a child of one of the groups in
    * groupIds, false otherwise.
    *
-   * @param $groupIds
-   *   Array of group ids (or one group id) to serve as the starting point.
+   * @param array $groupIds
+   *   of group ids (or one group id) to serve as the starting point.
    * @param $checkGroupId
    *   The group id to check if it is a child of the $groupIds group(s).
    *
-   * @return           boolean                True if $checkGroupId points to a group that is a child of one of the $groupIds groups, false otherwise.
-   *
+   * @return bool
+   *   True if $checkGroupId points to a group that is a child of one of the $groupIds groups, false otherwise.
    */
   public static function isChildGroup($groupIds, $checkGroupId) {
 
@@ -448,8 +449,8 @@ class CRM_Contact_BAO_GroupNesting extends CRM_Contact_DAO_GroupNesting implemen
       $childGroupId = $dao->child_group_id;
       if ($childGroupId == $checkGroupId) {
         /* print "One of these: <pre>";
-                 print_r($groupIds);
-                 print "</pre> has groupId $checkGroupId as a descendent.<br/><br/>"; */
+        print_r($groupIds);
+        print "</pre> has groupId $checkGroupId as a descendent.<br/><br/>"; */
 
         return TRUE;
       }
@@ -461,13 +462,13 @@ class CRM_Contact_BAO_GroupNesting extends CRM_Contact_DAO_GroupNesting implemen
    * Returns true if checkGroupId is an ancestor of one of the groups in
    * groupIds, false otherwise.
    *
-   * @param $groupIds
-   *   Array of group ids (or one group id) to serve as the starting point.
+   * @param array $groupIds
+   *   of group ids (or one group id) to serve as the starting point.
    * @param $checkGroupId
    *   The group id to check if it is an ancestor of the $groupIds group(s).
    *
-   * @return           boolean                True if $checkGroupId points to a group that is an ancestor of one of the $groupIds groups, false otherwise.
-   *
+   * @return bool
+   *   True if $checkGroupId points to a group that is an ancestor of one of the $groupIds groups, false otherwise.
    */
   public static function isAncestorGroup($groupIds, $checkGroupId) {
     if (!is_array($groupIds)) {
@@ -483,8 +484,8 @@ class CRM_Contact_BAO_GroupNesting extends CRM_Contact_DAO_GroupNesting implemen
       $parentGroupId = $dao->parent_group_id;
       if ($parentGroupId == $checkGroupId) {
         /* print "One of these: <pre>";
-                print_r($groupIds);
-                print "</pre> has groupId $checkGroupId as an ancestor.<br/>"; */
+        print_r($groupIds);
+        print "</pre> has groupId $checkGroupId as an ancestor.<br/>"; */
 
         return TRUE;
       }
@@ -502,13 +503,13 @@ class CRM_Contact_BAO_GroupNesting extends CRM_Contact_DAO_GroupNesting implemen
    * Returns true if checkGroupId is a descendent of one of the groups in
    * groupIds, false otherwise.
    *
-   * @param $groupIds
-   *   Array of group ids (or one group id) to serve as the starting point.
+   * @param array $groupIds
+   *   of group ids (or one group id) to serve as the starting point.
    * @param $checkGroupId
    *   The group id to check if it is a descendent of the $groupIds group(s).
    *
-   * @return           boolean                True if $checkGroupId points to a group that is a descendent of one of the $groupIds groups, false otherwise.
-   *
+   * @return bool
+   *   True if $checkGroupId points to a group that is a descendent of one of the $groupIds groups, false otherwise.
    */
   public static function isDescendentGroup($groupIds, $checkGroupId) {
     if (!is_array($groupIds)) {
@@ -524,8 +525,8 @@ class CRM_Contact_BAO_GroupNesting extends CRM_Contact_DAO_GroupNesting implemen
       $childGroupId = $dao->child_group_id;
       if ($childGroupId == $checkGroupId) {
         /* print "One of these: <pre>";
-                print_r($groupIds);
-                print "</pre> has groupId $checkGroupId as a descendent.<br/><br/>"; */
+        print_r($groupIds);
+        print "</pre> has groupId $checkGroupId as a descendent.<br/><br/>"; */
 
         return TRUE;
       }
@@ -542,12 +543,13 @@ class CRM_Contact_BAO_GroupNesting extends CRM_Contact_DAO_GroupNesting implemen
   /**
    * Returns array of group ids of ancestor groups of the specified group.
    *
-   * @param $groupIds
+   * @param array $groupIds
    *   An array of valid group ids (passed by reference).
    *
    * @param bool $includeSelf
    *
-   * @return array $groupIdArray         List of groupIds that represent the requested group and its ancestors@access public
+   * @return array
+   *   List of groupIds that represent the requested group and its ancestors@access public
    */
   public static function getAncestorGroupIds($groupIds, $includeSelf = TRUE) {
     if (!is_array($groupIds)) {
@@ -579,11 +581,12 @@ class CRM_Contact_BAO_GroupNesting extends CRM_Contact_DAO_GroupNesting implemen
   /**
    * Returns array of ancestor groups of the specified group.
    *
-   * @param $groupIds
+   * @param array $groupIds
    *   An array of valid group ids (passed by reference).
    *
    * @param bool $includeSelf
-   * @return \An $groupArray   List of ancestor groups@access public
+   * @return array
+   *   List of ancestor groups@access public
    */
   public static function getAncestorGroups($groupIds, $includeSelf = TRUE) {
     $groupIds = self::getAncestorGroupIds($groupIds, $includeSelf);
@@ -594,10 +597,11 @@ class CRM_Contact_BAO_GroupNesting extends CRM_Contact_DAO_GroupNesting implemen
   /**
    * Returns array of group ids of child groups of the specified group.
    *
-   * @param $groupIds
+   * @param array $groupIds
    *   An array of valid group ids (passed by reference).
    *
-   * @return array $groupIdArray List of groupIds that represent the requested group and its children@access public
+   * @return array
+   *   List of groupIds that represent the requested group and its children@access public
    */
   public static function getChildGroupIds($groupIds) {
     if (!is_array($groupIds)) {
@@ -616,10 +620,11 @@ class CRM_Contact_BAO_GroupNesting extends CRM_Contact_DAO_GroupNesting implemen
   /**
    * Returns array of group ids of parent groups of the specified group.
    *
-   * @param $groupIds
+   * @param array $groupIds
    *   An array of valid group ids (passed by reference).
    *
-   * @return array $groupIdArray         List of groupIds that represent the requested group and its parents@access public
+   * @return array
+   *   List of groupIds that represent the requested group and its parents@access public
    */
   public static function getParentGroupIds($groupIds) {
     if (!is_array($groupIds)) {
@@ -638,11 +643,12 @@ class CRM_Contact_BAO_GroupNesting extends CRM_Contact_DAO_GroupNesting implemen
   /**
    * Returns array of group ids of descendent groups of the specified group.
    *
-   * @param $groupIds
+   * @param array $groupIds
    *   An array of valid group ids (passed by reference).
    *
    * @param bool $includeSelf
-   * @return array $groupIdArray         List of groupIds that represent the requested group and its descendents@access public
+   * @return array
+   *   List of groupIds that represent the requested group and its descendents@access public
    */
   public static function getDescendentGroupIds($groupIds, $includeSelf = TRUE) {
     if (!is_array($groupIds)) {
@@ -672,11 +678,12 @@ class CRM_Contact_BAO_GroupNesting extends CRM_Contact_DAO_GroupNesting implemen
   /**
    * Returns array of descendent groups of the specified group.
    *
-   * @param $groupIds
-   *   An array of valid group ids (passed by reference).
+   * @param array $groupIds
+   *   An array of valid group ids
    *
    * @param bool $includeSelf
-   * @return \An $groupArray   List of descendent groups@access public
+   * @return array
+   *   List of descendent groups@access public
    */
   public static function getDescendentGroups($groupIds, $includeSelf = TRUE) {
     $groupIds = self::getDescendentGroupIds($groupIds, $includeSelf);
@@ -690,7 +697,8 @@ class CRM_Contact_BAO_GroupNesting extends CRM_Contact_DAO_GroupNesting implemen
    * @param $groupId
    *   The group id to get valid potential children for.
    *
-   * @return array $groupIdArray         List of groupIds that represent the valid potential children of the group@access public
+   * @return array
+   *   List of groupIds that represent the valid potential children of the group@access public
    */
   public static function getPotentialChildGroupIds($groupId) {
     $groups = CRM_Contact_BAO_Group::getGroups();
@@ -728,4 +736,5 @@ class CRM_Contact_BAO_GroupNesting extends CRM_Contact_DAO_GroupNesting implemen
 
     return $containingGroups;
   }
+
 }