[NFC] Minor code cleanup
[civicrm-core.git] / CRM / Event / Form / SelfSvcTransfer.php
index e5a628241c478a08270089452029666410485f7d..8fac0d8119e6320626ee715024d9876468c872be 100644 (file)
@@ -14,8 +14,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC https://civicrm.org/licensing
- * $Id$
- *
  */
 
 /**
@@ -131,9 +129,10 @@ class CRM_Event_Form_SelfSvcTransfer extends CRM_Core_Form {
    * be transferred to this participant - at this point no transaction changes processed
    *
    * return @void
+   *
+   * @throws \CRM_Core_Exception
    */
   public function preProcess() {
-    $config = CRM_Core_Config::singleton();
     $session = CRM_Core_Session::singleton();
     $this->_userContext = $session->readUserContext();
     $this->_from_participant_id = CRM_Utils_Request::retrieve('pid', 'Positive', $this, FALSE, NULL, 'REQUEST');
@@ -155,7 +154,7 @@ class CRM_Event_Form_SelfSvcTransfer extends CRM_Core_Form {
     if ($this->_from_participant_id) {
       $this->assign('participantId', $this->_from_participant_id);
     }
-    $event = [];
+
     $daoName = 'title';
     $this->_event_title = CRM_Event_BAO_Event::getFieldValue('CRM_Event_DAO_Event', $this->_event_id, $daoName);
     $daoName = 'start_date';
@@ -163,7 +162,7 @@ class CRM_Event_Form_SelfSvcTransfer extends CRM_Core_Form {
     list($displayName, $email) = CRM_Contact_BAO_Contact_Location::getEmailDetails($this->_from_contact_id);
     $this->_contact_name = $displayName;
     $this->_contact_email = $email;
-    $details = [];
+
     $details = CRM_Event_BAO_Participant::participantDetails($this->_from_participant_id);
     $optionGroupId = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_OptionGroup', 'participant_role', 'id', 'name');
     $query = "
@@ -296,7 +295,7 @@ class CRM_Event_Form_SelfSvcTransfer extends CRM_Core_Form {
     // verify whether this contact already registered for this event
     $contact_details = CRM_Contact_BAO_Contact::getContactDetails($contact_id);
     $display_name = $contact_details[0];
-    $query = "select event_id from civicrm_participant where contact_id = " . $contact_id;
+    $query = 'select event_id from civicrm_participant where contact_id = ' . $contact_id;
     $dao = CRM_Core_DAO::executeQuery($query);
     while ($dao->fetch()) {
       $to_event_id[] = $dao->event_id;
@@ -313,6 +312,8 @@ class CRM_Event_Form_SelfSvcTransfer extends CRM_Core_Form {
   /**
    * Process transfer - first add the new participant to the event, then cancel
    * source participant - send confirmation email to transferee
+   *
+   * @throws \CiviCRM_API3_Exception
    */
   public function postProcess() {
     //For transfer, process form to allow selection of transferree
@@ -324,7 +325,7 @@ class CRM_Event_Form_SelfSvcTransfer extends CRM_Core_Form {
       //cancel 'from' participant row
       $contact_id_result = civicrm_api3('Contact', 'get', [
         'sequential' => 1,
-        'return' => ["id"],
+        'return' => ['id'],
         'email' => $params['email'],
         'options' => ['limit' => 1],
       ]);
@@ -335,8 +336,8 @@ class CRM_Event_Form_SelfSvcTransfer extends CRM_Core_Form {
         CRM_Core_Error::statusBounce(ts('Contact does not exist.'));
       }
     }
-    $from_participant = $params = [];
-    $query = "select role_id, source, fee_level, is_test, is_pay_later, fee_amount, discount_id, fee_currency,campaign_id, discount_amount from civicrm_participant where id = " . $this->_from_participant_id;
+
+    $query = 'select role_id, source, fee_level, is_test, is_pay_later, fee_amount, discount_id, fee_currency,campaign_id, discount_amount from civicrm_participant where id = ' . $this->_from_participant_id;
     $dao = CRM_Core_DAO::executeQuery($query);
     $value_to = [];
     while ($dao->fetch()) {
@@ -397,6 +398,8 @@ class CRM_Event_Form_SelfSvcTransfer extends CRM_Core_Form {
    * Based on input, create participant row for transferee and send email
    *
    * return @ void
+   *
+   * @throws \CRM_Core_Exception
    */
   public function participantTransfer($participant) {
     $contactDetails = [];
@@ -502,7 +505,7 @@ class CRM_Event_Form_SelfSvcTransfer extends CRM_Core_Form {
     foreach ($tokens['domain'] as $token) {
       $domainValues[$token] = CRM_Utils_Token::getDomainTokenReplacement($token, $domain);
     }
-    $participantRoles = [];
+
     $participantRoles = CRM_Event_PseudoConstant::participantRole();
     $participantDetails = [];
     $query = "SELECT * FROM civicrm_participant WHERE id = {$this->_from_participant_id}";