[PHP8.2] Remove undeclared property
authorEileen McNaughton <emcnaughton@wikimedia.org>
Thu, 27 Jul 2023 21:46:19 +0000 (09:46 +1200)
committerEileen McNaughton <emcnaughton@wikimedia.org>
Thu, 27 Jul 2023 21:51:03 +0000 (09:51 +1200)
It appears to be copy & paste cos it is set but never used

CRM/Report/Form/Event/IncomeCountSummary.php

index 457eb69d7f577680d37ca414802dc4677b5b8d9e..b440dacbe17f8b95303f7e33114a3c83256767d8 100644 (file)
@@ -16,8 +16,6 @@
  */
 class CRM_Report_Form_Event_IncomeCountSummary extends CRM_Report_Form {
 
-  protected $_summary = NULL;
-
   protected $_add2groupSupported = FALSE;
 
   protected $_customGroupExtends = [
@@ -114,7 +112,7 @@ class CRM_Report_Form_Event_IncomeCountSummary extends CRM_Report_Form {
             'title' => ts('Participant Status'),
             'type' => CRM_Utils_Type::T_INT,
             'operatorType' => CRM_Report_Form::OP_MULTISELECT,
-            'options' => CRM_Event_PseudoConstant::participantStatus(NULL, NULL, "label"),
+            'options' => CRM_Event_PseudoConstant::participantStatus(NULL, NULL, 'label'),
           ],
           'rid' => [
             'name' => 'role_id',
@@ -141,11 +139,7 @@ class CRM_Report_Form_Event_IncomeCountSummary extends CRM_Report_Form {
     parent::__construct();
   }
 
-  public function preProcess() {
-    parent::preProcess();
-  }
-
-  public function select() {
+  public function select(): void {
     $select = [];
     foreach ($this->_columns as $tableName => $table) {
       if (array_key_exists('fields', $table)) {
@@ -190,10 +184,10 @@ class CRM_Report_Form_Event_IncomeCountSummary extends CRM_Report_Form {
     }
     $this->_selectClauses = $select;
 
-    $this->_select = "SELECT " . implode(', ', $select);
+    $this->_select = 'SELECT ' . implode(', ', $select);
   }
 
-  public function from() {
+  public function from(): void {
     $this->_from = "
         FROM civicrm_event {$this->_aliases['civicrm_event']}
              LEFT JOIN civicrm_participant {$this->_aliases['civicrm_participant']}
@@ -204,10 +198,9 @@ class CRM_Report_Form_Event_IncomeCountSummary extends CRM_Report_Form {
                        {$this->_aliases['civicrm_line_item']}.entity_table = 'civicrm_participant' ";
   }
 
-  public function where() {
+  public function where(): void {
     $clauses = [];
-    $this->_participantWhere = "";
-    foreach ($this->_columns as $tableName => $table) {
+    foreach ($this->_columns as $table) {
       if (array_key_exists('filters', $table)) {
         foreach ($table['filters'] as $fieldName => $field) {
           $clause = NULL;
@@ -231,10 +224,6 @@ class CRM_Report_Form_Event_IncomeCountSummary extends CRM_Report_Form {
               );
             }
           }
-          if (!empty($this->_params['id_value'])) {
-            $idValue = is_array($this->_params['id_value']) ? implode(',', $this->_params['id_value']) : $this->_params['id_value'];
-            $this->_participantWhere = " AND civicrm_participant.event_id IN ( $idValue ) ";
-          }
 
           if (!empty($clause)) {
             $clauses[] = $clause;
@@ -243,15 +232,16 @@ class CRM_Report_Form_Event_IncomeCountSummary extends CRM_Report_Form {
       }
     }
     $clauses[] = "{$this->_aliases['civicrm_event']}.is_template = 0";
-    $this->_where = "WHERE  " . implode(' AND ', $clauses);
+    $this->_where = 'WHERE  ' . implode(' AND ', $clauses);
   }
 
   /**
    * @param array $rows
    *
    * @return array
+   * @throws \Civi\Core\Exception\DBQueryException
    */
-  public function statistics(&$rows) {
+  public function statistics(&$rows): array {
     $statistics = parent::statistics($rows);
     $select = "
          SELECT SUM( {$this->_aliases['civicrm_line_item']}.participant_count ) as count,
@@ -285,9 +275,9 @@ class CRM_Report_Form_Event_IncomeCountSummary extends CRM_Report_Form {
     return $statistics;
   }
 
-  public function groupBy() {
+  public function groupBy(): void {
     $this->assign('chartSupported', TRUE);
-    $this->_rollup = " WITH ROLLUP";
+    $this->_rollup = ' WITH ROLLUP';
     $this->_select = CRM_Contact_BAO_Query::appendAnyValueToSelect($this->_selectClauses, "{$this->_aliases['civicrm_event']}.id");
     $this->_groupBy = " GROUP BY {$this->_aliases['civicrm_event']}.id {$this->_rollup}";
   }
@@ -303,19 +293,18 @@ class CRM_Report_Form_Event_IncomeCountSummary extends CRM_Report_Form {
     //set pager before execution of query in function participantInfo()
     $this->setPager();
 
-    $rows = $graphRows = [];
-    $count = 0;
+    $rows = [];
 
     while ($dao->fetch()) {
       $row = [];
       foreach ($this->_columnHeaders as $key => $value) {
-        if (($key == 'civicrm_event_start_date') ||
-          ($key == 'civicrm_event_end_date')
+        if (($key === 'civicrm_event_start_date') ||
+          ($key === 'civicrm_event_end_date')
         ) {
           //get event start date and end date in custom datetime format
           $row[$key] = CRM_Utils_Date::customFormat($dao->$key);
         }
-        elseif ($key == 'civicrm_participant_fee_amount_avg') {
+        elseif ($key === 'civicrm_participant_fee_amount_avg') {
           if ($dao->civicrm_participant_fee_amount_sum &&
             $dao->civicrm_line_item_participant_count_count
           ) {
@@ -323,7 +312,7 @@ class CRM_Report_Form_Event_IncomeCountSummary extends CRM_Report_Form {
               $dao->civicrm_line_item_participant_count_count;
           }
         }
-        elseif ($key == 'civicrm_line_item_line_total_avg') {
+        elseif ($key === 'civicrm_line_item_line_total_avg') {
           if ($dao->civicrm_line_item_line_total_sum &&
             $dao->civicrm_line_item_participant_count_count
           ) {
@@ -331,10 +320,8 @@ class CRM_Report_Form_Event_IncomeCountSummary extends CRM_Report_Form {
               $dao->civicrm_line_item_participant_count_count;
           }
         }
-        else {
-          if (isset($dao->$key)) {
-            $row[$key] = $dao->$key;
-          }
+        elseif (isset($dao->$key)) {
+          $row[$key] = $dao->$key;
         }
       }
       $rows[] = $row;
@@ -360,8 +347,8 @@ class CRM_Report_Form_Event_IncomeCountSummary extends CRM_Report_Form {
       foreach ($rows as $key => $value) {
         if ($value['civicrm_event_id']) {
           $graphRows['totalParticipants'][] = ($rows[$key]['civicrm_line_item_participant_count_count']);
-          $graphRows[$this->_interval][] = substr($rows[$key]['civicrm_event_title'], 0, 12) . "..(" .
-            $rows[$key]['civicrm_event_id'] . ") ";
+          $graphRows[$this->_interval][] = substr($rows[$key]['civicrm_event_title'], 0, 12) . '..(' .
+            $rows[$key]['civicrm_event_id'] . ') ';
           $graphRows['value'][] = ($rows[$key]['civicrm_line_item_participant_count_count']);
         }
       }
@@ -414,7 +401,7 @@ class CRM_Report_Form_Event_IncomeCountSummary extends CRM_Report_Form {
               $this->_absoluteUrl, $this->_id, $this->_drilldownReport
             );
             $rows[$rowNum]['civicrm_event_title_link'] = $url;
-            $rows[$rowNum]['civicrm_event_title_hover'] = ts("View Event Participants For this Event");
+            $rows[$rowNum]['civicrm_event_title_hover'] = ts('View Event Participants For this Event');
           }
         }