Merge pull request #4962 from totten/master-angular-ts
[civicrm-core.git] / CRM / Core / BAO / OptionGroup.php
index 09592e0cfd6fe3ed872824f6ce736e2534f628c3..883828e743a2ed3eda83d3c2a16cffd26276466e 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.5                                                |
+ | CiviCRM version 4.6                                                |
  +--------------------------------------------------------------------+
  | Copyright CiviCRM LLC (c) 2004-2014                                |
  +--------------------------------------------------------------------+
@@ -23,7 +23,7 @@
  | GNU Affero General Public License or the licensing of CiviCRM,     |
  | see the CiviCRM license FAQ at http://civicrm.org/licensing        |
  +--------------------------------------------------------------------+
-*/
+ */
 
 /**
  *
 class CRM_Core_BAO_OptionGroup extends CRM_Core_DAO_OptionGroup {
 
   /**
-   * class constructor
+   * Class constructor
    */
-  function __construct() {
+  public function __construct() {
     parent::__construct();
   }
 
   /**
-   * Takes a bunch of params that are needed to match certain criteria and
-   * retrieves the relevant objects. Typically the valid params are only
-   * contact_id. We'll tweak this function to be more full featured over a period
-   * of time. This is the inverse function of create. It also stores all the retrieved
-   * values in the default array
+   * Fetch object based on array of properties
    *
-   * @param array $params   (reference ) an assoc array of name/value pairs
-   * @param array $defaults (reference ) an assoc array to hold the flattened values
+   * @param array $params
+   *   (reference ) an assoc array of name/value pairs.
+   * @param array $defaults
+   *   (reference ) an assoc array to hold the flattened values.
    *
-   * @return object CRM_Core_BAO_OptionGroup object
-   * @access public
-   * @static
+   * @return CRM_Core_BAO_OptionGroup
    */
-  static function retrieve(&$params, &$defaults) {
+  public static function retrieve(&$params, &$defaults) {
     $optionGroup = new CRM_Core_DAO_OptionGroup();
     $optionGroup->copyValues($params);
     if ($optionGroup->find(TRUE)) {
@@ -66,31 +62,33 @@ class CRM_Core_BAO_OptionGroup extends CRM_Core_DAO_OptionGroup {
   }
 
   /**
-   * update the is_active flag in the db
+   * Update the is_active flag in the db
    *
-   * @param int      $id        id of the database record
-   * @param boolean  $is_active value we want to set the is_active field
+   * @param int $id
+   *   Id of the database record.
+   * @param bool $is_active
+   *   Value we want to set the is_active field.
    *
-   * @return Object             DAO object on sucess, null otherwise
-   * @static
+   * @return Object
+   *   DAO object on sucess, null otherwise
    */
-  static function setIsActive($id, $is_active) {
+  public static function setIsActive($id, $is_active) {
     return CRM_Core_DAO::setFieldValue('CRM_Core_DAO_OptionGroup', $id, 'is_active', $is_active);
   }
 
   /**
-   * function to add the Option Group
+   * Add the Option Group
    *
-   * @param array $params reference array contains the values submitted by the form
-   * @param array $ids    reference array contains the id
+   * @param array $params
+   *   Reference array contains the values submitted by the form.
+   * @param array $ids
+   *   Reference array contains the id.
    *
-   * @access public
-   * @static
    *
    * @return object
    */
-  static function add(&$params, $ids = array()) {
-    if(empty($params['id'])){
+  public static function add(&$params, $ids = array()) {
+    if (empty($params['id'])) {
       $params['id'] = CRM_Utils_Array::value('optionGroup', $ids);
     }
 
@@ -111,16 +109,12 @@ class CRM_Core_BAO_OptionGroup extends CRM_Core_DAO_OptionGroup {
   }
 
   /**
-   * Function to delete Option Group
-   *
-   * @param  int  $optionGroupId     Id of the Option Group to be deleted.
-   *
-   * @return void
+   * Delete Option Group
    *
-   * @access public
-   * @static
+   * @param int $optionGroupId
+   *   Id of the Option Group to be deleted.
    */
-  static function del($optionGroupId) {
+  public static function del($optionGroupId) {
     // need to delete all option value field before deleting group
     $optionValue = new CRM_Core_DAO_OptionValue();
     $optionValue->option_group_id = $optionGroupId;
@@ -132,20 +126,19 @@ class CRM_Core_BAO_OptionGroup extends CRM_Core_DAO_OptionGroup {
   }
 
   /**
-   * Function to get title of the option group
+   * Get title of the option group
    *
-   * @param  int  $optionGroupId     Id of the Option Group.
+   * @param int $optionGroupId
+   *   Id of the Option Group.
    *
-   * @return String title
-   *
-   * @access public
-   * @static
+   * @return string
+   *   title
    */
-  static function getTitle($optionGroupId) {
+  public static function getTitle($optionGroupId) {
     $optionGroup = new CRM_Core_DAO_OptionGroup();
     $optionGroup->id = $optionGroupId;
     $optionGroup->find(TRUE);
     return $optionGroup->name;
   }
-}
 
+}