Merge pull request #15261 from JKingsnorth/report-paths-not-public
[civicrm-core.git] / api / v3 / ReportTemplate.php
index d13cd54b44947a48c0b59bb9f8502cd9554a2461..5fd747431899a5bbafbfbb1ca0ae916f2b2bd0fe 100644 (file)
@@ -3,7 +3,7 @@
  +--------------------------------------------------------------------+
  | CiviCRM version 5                                                  |
  +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2017                                |
+ | Copyright CiviCRM LLC (c) 2004-2019                                |
  +--------------------------------------------------------------------+
  | This file is a part of CiviCRM.                                    |
  |                                                                    |
@@ -63,7 +63,7 @@ function civicrm_api3_report_template_create($params) {
     'CRM_Core_DAO_OptionGroup', 'report_template', 'id', 'name'
   );
   if (!empty($params['component_id']) && !is_numeric($params['component_id'])) {
-    $components = CRM_Core_PseudoConstant::get('CRM_Core_DAO_OptionValue', 'component_id', array('onlyActive' => FALSE, 'labelColumn' => 'name'));
+    $components = CRM_Core_PseudoConstant::get('CRM_Core_DAO_OptionValue', 'component_id', ['onlyActive' => FALSE, 'labelColumn' => 'name']);
     $params['component_id'] = array_search($params['component_id'], $components);
   }
   return civicrm_api3_option_value_create($params);
@@ -80,8 +80,8 @@ function civicrm_api3_report_template_create($params) {
 function _civicrm_api3_report_template_create_spec(&$params) {
   require_once 'api/v3/OptionValue.php';
   _civicrm_api3_option_value_create_spec($params);
-  $params['value']['api.aliases'] = array('report_url');
-  $params['name']['api.aliases'] = array('class_name');
+  $params['value']['api.aliases'] = ['report_url'];
+  $params['name']['api.aliases'] = ['class_name'];
   $params['option_group_id']['api.default'] = CRM_Core_DAO::getFieldValue(
     'CRM_Core_DAO_OptionGroup', 'report_template', 'id', 'name'
   );
@@ -111,7 +111,7 @@ function civicrm_api3_report_template_delete($params) {
  *   API result array
  */
 function civicrm_api3_report_template_getrows($params) {
-  civicrm_api3_verify_one_mandatory($params, NULL, array('report_id', 'instance_id'));
+  civicrm_api3_verify_one_mandatory($params, NULL, ['report_id', 'instance_id']);
   list($rows, $instance, $metadata) = _civicrm_api3_report_template_getrows($params);
   $instance->cleanUpTemporaryTables();
   return civicrm_api3_create_success($rows, $params, 'ReportTemplate', 'getrows', CRM_Core_DAO::$_nullObject, $metadata);
@@ -128,14 +128,14 @@ function civicrm_api3_report_template_getrows($params) {
  */
 function _civicrm_api3_report_template_getrows($params) {
   if (empty($params['report_id'])) {
-    $params['report_id'] = civicrm_api3('report_instance', 'getvalue', array('id' => $params['instance_id'], 'return' => 'report_id'));
+    $params['report_id'] = civicrm_api3('report_instance', 'getvalue', ['id' => $params['instance_id'], 'return' => 'report_id']);
   }
 
-  $class = (string) civicrm_api3('option_value', 'getvalue', array(
+  $class = (string) civicrm_api3('option_value', 'getvalue', [
     'option_group_name' => 'report_template',
     'return' => 'name',
     'value' => $params['report_id'],
-    )
+  ]
   );
 
   $reportInstance = new $class();
@@ -154,7 +154,7 @@ function _civicrm_api3_report_template_getrows($params) {
   $reportInstance->beginPostProcessCommon();
   $sql = $reportInstance->buildQuery();
   $reportInstance->addToDeveloperTab($sql);
-  $rows = $metadata = $requiredMetadata  = array();
+  $rows = $metadata = $requiredMetadata = [];
   $reportInstance->buildRows($sql, $rows);
   $reportInstance->formatDisplay($rows);
 
@@ -174,7 +174,7 @@ function _civicrm_api3_report_template_getrows($params) {
       $metadata['metadata']['sql'] = $reportInstance->getReportSql();
     }
   }
-  return array($rows, $reportInstance, $metadata);
+  return [$rows, $reportInstance, $metadata];
 }
 
 /**
@@ -191,6 +191,7 @@ function civicrm_api3_report_template_getstatistics($params) {
   $reportInstance->cleanUpTemporaryTables();
   return civicrm_api3_create_success($stats, $params, 'ReportTemplate', 'getstatistics', CRM_Core_DAO::$_nullObject, $metadata);
 }
+
 /**
  * Adjust metadata for template getrows action.
  *
@@ -198,9 +199,9 @@ function civicrm_api3_report_template_getstatistics($params) {
  *   Input parameters.
  */
 function _civicrm_api3_report_template_getrows_spec(&$params) {
-  $params['report_id'] = array(
+  $params['report_id'] = [
     'title' => 'Report ID - eg. member/lapse',
-  );
+  ];
 }
 
 /* @codingStandardsIgnoreStart