INFRA-132 - CRM/Event - phpcbf
[civicrm-core.git] / CRM / Event / Cart / Form / Cart.php
index 89e323257a587e6a336d31cef0c09566ea9f155e..58316bfef778eb11e16d18de01672d597ce37c77 100644 (file)
@@ -1,4 +1,8 @@
 <?php
+
+/**
+ * Class CRM_Event_Cart_Form_Cart
+ */
 class CRM_Event_Cart_Form_Cart extends CRM_Core_Form {
   public $cart;
 
@@ -29,7 +33,7 @@ class CRM_Event_Cart_Form_Cart extends CRM_Core_Form {
     }
   }
 
-  function loadCart() {
+  public function loadCart() {
     if ($this->event_cart_id == NULL) {
       $this->cart = CRM_Event_Cart_BAO_Cart::find_or_create_for_current_session();
     }
@@ -40,7 +44,7 @@ class CRM_Event_Cart_Form_Cart extends CRM_Core_Form {
     $this->stub_out_and_inherit();
   }
 
-  function stub_out_and_inherit() {
+  public function stub_out_and_inherit() {
     $transaction = new CRM_Core_Transaction();
 
     foreach ($this->cart->get_main_events_in_carts() as $event_in_cart) {
@@ -59,7 +63,7 @@ class CRM_Event_Cart_Form_Cart extends CRM_Core_Form {
     $transaction->commit();
   }
 
-  function checkWaitingList() {
+  public function checkWaitingList() {
     foreach ($this->cart->events_in_carts as $event_in_cart) {
       $empty_seats = $this->checkEventCapacity($event_in_cart->event_id);
       if ($empty_seats === NULL) {
@@ -72,7 +76,12 @@ class CRM_Event_Cart_Form_Cart extends CRM_Core_Form {
     }
   }
 
-  function checkEventCapacity($event_id) {
+  /**
+   * @param int $event_id
+   *
+   * @return bool|int|null|string
+   */
+  public function checkEventCapacity($event_id) {
     $empty_seats = CRM_Event_BAO_Participant::eventFull($event_id, TRUE);
     if (is_numeric($empty_seats)) {
       return $empty_seats;
@@ -85,12 +94,18 @@ class CRM_Event_Cart_Form_Cart extends CRM_Core_Form {
     }
   }
 
-  static function is_administrator() {
+  /**
+   * @return bool
+   */
+  public static function is_administrator() {
     global $user;
     return CRM_Core_Permission::check('administer CiviCRM');
   }
 
-  function getContactID() {
+  /**
+   * @return mixed
+   */
+  public function getContactID() {
     //XXX when do we query 'cid' ?
     $tempID = CRM_Utils_Request::retrieve('cid', 'Positive', $this);
 
@@ -109,18 +124,29 @@ class CRM_Event_Cart_Form_Cart extends CRM_Core_Form {
     return $session->get('userID');
   }
 
-  static function find_contact($fields) {
+  /**
+   * @param $fields
+   *
+   * @return mixed|null
+   */
+  public static function find_contact($fields) {
     $dedupe_params = CRM_Dedupe_Finder::formatParams($fields, 'Individual');
     $dedupe_params['check_permission'] = FALSE;
     $ids = CRM_Dedupe_Finder::dupesByParams($dedupe_params, 'Individual');
     if (is_array($ids)) {
       return array_pop($ids);
     }
-    else return NULL;
+    else { return NULL;
+    }
   }
 
-  static function find_or_create_contact($registeringContactID = NULL, $fields = array(
-    )) {
+  /**
+   * @param int $registeringContactID
+   * @param array $fields
+   *
+   * @return int|mixed|null
+   */
+  public static function find_or_create_contact($registeringContactID = NULL, $fields = array()) {
     $contact_id = self::find_contact($fields);
 
     if ($contact_id) {
@@ -140,9 +166,13 @@ class CRM_Event_Cart_Form_Cart extends CRM_Core_Form {
     return $contact_id;
   }
 
-  function getValuesForPage($page_name) {
+  /**
+   * @param string $page_name
+   *
+   * @return mixed
+   */
+  public function getValuesForPage($page_name) {
     $container = $this->controller->container();
     return $container['values'][$page_name];
   }
 }
-