Merge pull request #4871 from eileenmcnaughton/CRM-15795
[civicrm-core.git] / CRM / Core / BAO / Discount.php
index 3d5888867f2412c4ce65bbecc44d2f413f639c31..c474aa5107a0d2cd68e0a60083387a9c8ae43c77 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.5                                                |
+ | CiviCRM version 4.6                                                |
  +--------------------------------------------------------------------+
  | Copyright CiviCRM LLC (c) 2004-2014                                |
  +--------------------------------------------------------------------+
 class CRM_Core_BAO_Discount extends CRM_Core_DAO_Discount {
 
   /**
-   * class constructor
+   * Class constructor
    */
-  function __construct() {
+  public function __construct() {
     parent::__construct();
   }
 
   /**
-   * Function to delete the discount
+   * Delete the discount
    *
-   * @param int $id   discount id
+   * @param int $entityId
+   * @param string $entityTable
    *
    * @return boolean
-   * @access public
    * @static
-   *
    */
-  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 = new CRM_Core_DAO_Discount();
     $discount->entity_id    = $entityId;
     $discount->entity_table = $entityTable;
     if ($discount->delete()) {
@@ -68,14 +67,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
    */
-  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,15 +84,17 @@ 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
+   * @param int $entityIdEntity id to be searched.
+   *   Entity id to be searched.
+   * @param string $entityTable
+   *   Entity table to be searched.
    *
    * @return array    $optionGroupIDs option group Ids associated with discount
    *
    */
-  static function getOptionGroup($entityId, $entityTable) {
+  public static function getOptionGroup($entityId, $entityTable) {
     $optionGroupIDs    = array();
-    $dao = new CRM_Core_DAO_Discount( );
+    $dao = new CRM_Core_DAO_Discount();
     $dao->entity_id    = $entityId;
     $dao->entity_table = $entityTable;
     $dao->find();
@@ -106,22 +107,22 @@ class CRM_Core_BAO_Discount extends CRM_Core_DAO_Discount {
   /**
    * Determine in which discount set the registration date falls
    *
-   * @param  integer  $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
    *                                 the date criteria
    */
-  static function findSet($entityID, $entityTable) {
-    if (empty($entityID) ||
-      empty($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 = new CRM_Core_DAO_Discount();
     $dao->entity_id    = $entityID;
     $dao->entity_table = $entityTable;
     $dao->find();
@@ -141,4 +142,3 @@ class CRM_Core_BAO_Discount extends CRM_Core_DAO_Discount {
   }
 
 }
-