Merge pull request #14249 from yashodha/959_dev
[civicrm-core.git] / CRM / Contribute / Form / ContributionCharts.php
index 56002dbce175f94a7873c557093fef7e0e2c3614..ac5866da5bd00bd10a6453274356642e48dfa157 100644 (file)
@@ -3,7 +3,7 @@
  +--------------------------------------------------------------------+
  | CiviCRM version 5                                                  |
  +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2018                                |
+ | Copyright CiviCRM LLC (c) 2004-2019                                |
  +--------------------------------------------------------------------+
  | This file is a part of CiviCRM.                                    |
  |                                                                    |
@@ -28,7 +28,7 @@
 /**
  *
  * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2018
+ * @copyright CiviCRM LLC (c) 2004-2019
  */
 class CRM_Contribute_Form_ContributionCharts extends CRM_Core_Form {
 
@@ -65,17 +65,16 @@ class CRM_Contribute_Form_ContributionCharts extends CRM_Core_Form {
   public function buildQuickForm() {
     //p3 = Three dimensional pie chart.
     //bvg = Vertical bar chart
-    $this->addElement('select', 'chart_type', ts('Chart Style'), array(
-        'bvg' => ts('Bar'),
-        'p3' => ts('Pie'),
-      )
-    );
+    $this->addElement('select', 'chart_type', ts('Chart Style'), [
+      'bvg' => ts('Bar'),
+      'p3' => ts('Pie'),
+    ]);
     $defaultValues['chart_type'] = $this->_chartType;
     $this->setDefaults($defaultValues);
 
     //take available years from database to show in drop down
     $currentYear = date('Y');
-    $years = array();
+    $years = [];
     if (!empty($this->_years)) {
       if (!array_key_exists($currentYear, $this->_years)) {
         $this->_years[$currentYear] = $currentYear;
@@ -87,9 +86,9 @@ class CRM_Contribute_Form_ContributionCharts extends CRM_Core_Form {
     }
 
     $this->addElement('select', 'select_year', ts('Select Year (for monthly breakdown)'), $years);
-    $this->setDefaults(array(
+    $this->setDefaults([
       'select_year' => ($this->_year) ? $this->_year : $currentYear,
-    ));
+    ]);
   }
 
   /**
@@ -109,7 +108,7 @@ class CRM_Contribute_Form_ContributionCharts extends CRM_Core_Form {
     //take contribution information monthly
     $chartInfoMonthly = CRM_Contribute_BAO_Contribution_Utils::contributionChartMonthly($selectedYear);
 
-    $chartData = $abbrMonthNames = array();
+    $chartData = $abbrMonthNames = [];
     if (is_array($chartInfoMonthly)) {
       for ($i = 1; $i <= 12; $i++) {
         $abbrMonthNames[$i] = strftime('%b', mktime(0, 0, 0, $i, 10, 1970));
@@ -186,7 +185,7 @@ class CRM_Contribute_Form_ContributionCharts extends CRM_Core_Form {
         $urlParams = NULL;
         if ($chartKey == 'by_month') {
           $monthPosition = array_search($index, $abbrMonthNames);
-          $startDate = CRM_Utils_Date::format(array('Y' => $selectedYear, 'M' => $monthPosition));
+          $startDate = CRM_Utils_Date::format(['Y' => $selectedYear, 'M' => $monthPosition]);
           $endDate = date('Ymd', mktime(0, 0, 0, $monthPosition + 1, 0, $selectedYear));
           $urlParams = "reset=1&force=1&status=1&start={$startDate}&end={$endDate}&test=0";
         }
@@ -196,7 +195,7 @@ class CRM_Contribute_Form_ContributionCharts extends CRM_Core_Form {
             $endDate = date('Ymd', mktime(0, 0, 0, $config->fiscalYearStart['M'], $config->fiscalYearStart['d'], (substr($index, 0, 4)) + 1));
           }
           else {
-            $startDate = CRM_Utils_Date::format(array('Y' => substr($index, 0, 4)));
+            $startDate = CRM_Utils_Date::format(['Y' => substr($index, 0, 4)]);
             $endDate = date('Ymd', mktime(0, 0, 0, 13, 0, substr($index, 0, 4)));
           }
           $urlParams = "reset=1&force=1&status=1&start={$startDate}&end={$endDate}&test=0";
@@ -225,7 +224,7 @@ class CRM_Contribute_Form_ContributionCharts extends CRM_Core_Form {
           $xSize = 150;
         }
       }
-      $values['size'] = array('xSize' => $xSize, 'ySize' => $ySize);
+      $values['size'] = ['xSize' => $xSize, 'ySize' => $ySize];
     }
 
     // finally assign this chart data to template.