INFRA-132 - Misc
[civicrm-core.git] / CRM / Core / BAO / Discount.php
index ba79ac3d5aeb2c6c7c06ca314d726415194548ed..325dabb7f104d90dbfc94f383d13eb1f45d1943a 100644 (file)
@@ -23,7 +23,7 @@
  | GNU Affero General Public License or the licensing of CiviCRM,     |
  | see the CiviCRM license FAQ at http://civicrm.org/licensing        |
  +--------------------------------------------------------------------+
-*/
+ */
 
 /**
  *
@@ -37,7 +37,7 @@ class CRM_Core_BAO_Discount extends CRM_Core_DAO_Discount {
   /**
    * Class constructor
    */
-  function __construct() {
+  public function __construct() {
     parent::__construct();
   }
 
@@ -47,14 +47,12 @@ class CRM_Core_BAO_Discount extends CRM_Core_DAO_Discount {
    * @param int $entityId
    * @param string $entityTable
    *
-   * @return boolean
-   * @access public
-   * @static
+   * @return bool
    */
-  static function del($entityId,$entityTable) {
+  public static function del($entityId, $entityTable) {
     // delete all discount records with the selected discounted id
-    $discount = new CRM_Core_DAO_Discount( );
-    $discount->entity_id    = $entityId;
+    $discount = new CRM_Core_DAO_Discount();
+    $discount->entity_id = $entityId;
     $discount->entity_table = $entityTable;
     if ($discount->delete()) {
       return TRUE;
@@ -68,14 +66,14 @@ class CRM_Core_BAO_Discount extends CRM_Core_DAO_Discount {
    * discount object. the params array contains additional unused name/value
    * pairs
    *
-   * @param array  $params         (reference) an assoc array of name/value pairs
+   * @param array $params
+   *   (reference) an assoc array of name/value pairs.
    *
-   * @return object    CRM_Core_DAO_Discount object on success, otherwise null
-   * @access public
-   * @static
+   * @return object
+   *   CRM_Core_DAO_Discount object on success, otherwise null
    */
-  static function add(&$params) {
-    $discount = new CRM_Core_DAO_Discount( );
+  public static function add(&$params) {
+    $discount = new CRM_Core_DAO_Discount();
     $discount->copyValues($params);
     $discount->save();
     return $discount;
@@ -85,16 +83,18 @@ class CRM_Core_BAO_Discount extends CRM_Core_DAO_Discount {
    * Determine whether the given table/id
    * has discount associated with it
    *
-   * @param  integer  $entityId      entity id to be searched
-   * @param  string   $entityTable   entity table to be searched
-   *
-   * @return array    $optionGroupIDs option group Ids associated with discount
+   * @param int $entityId
+   *   Entity id to be searched.
+   * @param string $entityTable
+   *   Entity table to be searched.
    *
+   * @return array
+   *   option group Ids associated with discount
    */
-  static function getOptionGroup($entityId, $entityTable) {
-    $optionGroupIDs    = array();
-    $dao = new CRM_Core_DAO_Discount( );
-    $dao->entity_id    = $entityId;
+  public static function getOptionGroup($entityId, $entityTable) {
+    $optionGroupIDs = array();
+    $dao = new CRM_Core_DAO_Discount();
+    $dao->entity_id = $entityId;
     $dao->entity_table = $entityTable;
     $dao->find();
     while ($dao->fetch()) {
@@ -106,21 +106,24 @@ class CRM_Core_BAO_Discount extends CRM_Core_DAO_Discount {
   /**
    * Determine in which discount set the registration date falls
    *
-   * @param int $entityID entity id to be searched
-   * @param string $entityTable entity table to be searched
+   * @param int $entityID
+   *   Entity id to be searched.
+   * @param string $entityTable
+   *   Entity table to be searched.
    *
-   * @return integer  $dao->id       discount id of the set which matches
+   * @return int
+   *   $dao->id       discount id of the set which matches
    *                                 the date criteria
    */
-  static function findSet($entityID, $entityTable) {
+  public static function findSet($entityID, $entityTable) {
     if (empty($entityID) || empty($entityTable)) {
       // adding this here, to trap errors if values are not sent
       CRM_Core_Error::fatal();
       return NULL;
     }
 
-    $dao = new CRM_Core_DAO_Discount( );
-    $dao->entity_id    = $entityID;
+    $dao = new CRM_Core_DAO_Discount();
+    $dao->entity_id = $entityID;
     $dao->entity_table = $entityTable;
     $dao->find();
 
@@ -139,4 +142,3 @@ class CRM_Core_BAO_Discount extends CRM_Core_DAO_Discount {
   }
 
 }
-