Merge pull request #15248 from MegaphoneJon/reporting-19
[civicrm-core.git] / CRM / Event / Tokens.php
index 7b95b8806236dd5d023452fb91a9f5a88f393972..a0bbe5d25f062fbdd0f3b9b9c060387dc3d9cc6f 100644 (file)
@@ -4,7 +4,7 @@
  +--------------------------------------------------------------------+
  | CiviCRM version 5                                                  |
  +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2018                                |
+ | Copyright CiviCRM LLC (c) 2004-2020                                |
  +--------------------------------------------------------------------+
  | This file is a part of CiviCRM.                                    |
  |                                                                    |
@@ -45,7 +45,7 @@ class CRM_Event_Tokens extends \Civi\Token\AbstractTokenSubscriber {
    */
   public function __construct() {
     parent::__construct('event', array_merge(
-      array(
+      [
         'event_type' => ts('Event Type'),
         'title' => ts('Event Title'),
         'event_id' => ts('Event ID'),
@@ -60,7 +60,7 @@ class CRM_Event_Tokens extends \Civi\Token\AbstractTokenSubscriber {
         'contact_email' => ts('Event Contact (Email)'),
         'contact_phone' => ts('Event Contact (Phone)'),
         'balance' => ts('Event Balance'),
-      ),
+      ],
       CRM_Utils_Token::getCustomFieldTokens('Event')
     ));
   }
@@ -70,8 +70,7 @@ class CRM_Event_Tokens extends \Civi\Token\AbstractTokenSubscriber {
    */
   public function checkActive(\Civi\Token\TokenProcessor $processor) {
     // Extracted from scheduled-reminders code. See the class description.
-    return
-      !empty($processor->context['actionMapping'])
+    return !empty($processor->context['actionMapping'])
       && $processor->context['actionMapping']->getEntity() === 'civicrm_participant';
   }
 
@@ -85,7 +84,8 @@ class CRM_Event_Tokens extends \Civi\Token\AbstractTokenSubscriber {
       return;
     }
 
-    $e->query->select('e.*'); // FIXME: seems too broad.
+    // FIXME: seems too broad.
+    $e->query->select('e.*');
     $e->query->select('ov.label as event_type, ev.title, ev.id as event_id, ev.start_date, ev.end_date, ev.summary, ev.description, address.street_address, address.city, address.state_province_id, address.postal_code, email.email as contact_email, phone.phone as contact_phone');
     $e->query->join('participant_stuff', "
 !casMailingJoinType civicrm_event ev ON e.event_id = ev.id
@@ -105,7 +105,7 @@ LEFT JOIN civicrm_phone phone ON phone.id = lb.phone_id
     $actionSearchResult = $row->context['actionSearchResult'];
 
     if ($field == 'location') {
-      $loc = array();
+      $loc = [];
       $stateProvince = \CRM_Core_PseudoConstant::stateProvince();
       $loc['street_address'] = $actionSearchResult->street_address;
       $loc['city'] = $actionSearchResult->city;
@@ -122,7 +122,7 @@ LEFT JOIN civicrm_phone phone ON phone.id = lb.phone_id
       $row
         ->tokens($entity, $field, \CRM_Utils_System::url('civicrm/event/register', 'reset=1&id=' . $actionSearchResult->event_id, TRUE, NULL, FALSE));
     }
-    elseif (in_array($field, array('start_date', 'end_date'))) {
+    elseif (in_array($field, ['start_date', 'end_date'])) {
       $row->tokens($entity, $field, \CRM_Utils_Date::customFormat($actionSearchResult->$field));
     }
     elseif ($field == 'balance') {