phpcs - Fix error, "Visibility must be declared on method"
[civicrm-core.git] / CRM / Report / Form / Contribute / PCP.php
index 8f6211e53f5b40e4e4c2d0500c071676fabad55c..81a26e4bcd336b0e5657416a49ab6fd6461ecd1b 100644 (file)
@@ -2,7 +2,7 @@
 
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.5                                                |
+ | CiviCRM version 4.6                                                |
  +--------------------------------------------------------------------+
  | Copyright CiviCRM LLC (c) 2004-2014                                |
  +--------------------------------------------------------------------+
  *
  */
 class CRM_Report_Form_Contribute_PCP extends CRM_Report_Form {
-  function __construct() {
+  /**
+   *
+   */
+  /**
+   *
+   */
+  public function __construct() {
     $this->_columns = array(
-      'civicrm_contact' =>
-      array(
+      'civicrm_contact' => array(
         'dao' => 'CRM_Contact_DAO_Contact',
-        'fields' =>
-        array(
-          'sort_name' =>
-          array('title' => ts('Supporter'),
+        'fields' => array(
+          'sort_name' => array(
+            'title' => ts('Supporter'),
             'required' => TRUE,
             'default' => TRUE,
           ),
-          'id' =>
-          array(
+          'id' => array(
             'required' => TRUE,
             'no_display' => TRUE,
           ),
-          'contact_type' =>
-          array(
+          'contact_type' => array(
             'title' => ts('Supporter Contact Type'),
           ),
-          'contact_sub_type' =>
-          array(
-            'title' => ts('Supporter Contact SubType'),
+          'contact_sub_type' => array(
+            'title' => ts('Supporter Contact Subtype'),
           ),
         ),
-        'filters' =>
-        array(
-          'sort_name' =>
-          array('title' => ts('Supporter Name'),
+        'filters' => array(
+          'sort_name' => array(
+            'title' => ts('Supporter Name'),
             'type' => CRM_Utils_Type::T_STRING,
             'operator' => 'like',
           ),
-          'id' =>
-          array('title' => ts('Contact ID'),
+          'id' => array(
+            'title' => ts('Contact ID'),
             'no_display' => TRUE,
           ),
         ),
         'grouping' => 'pcp-fields',
       ),
-      'civicrm_contribution_page' =>
-      array(
+      'civicrm_contribution_page' => array(
         'dao' => 'CRM_Contribute_DAO_ContributionPage',
-        'fields' =>
-        array(
-          'page_title' =>
-          array('title' => ts('Contribution Page Title'),
+        'fields' => array(
+          'page_title' => array(
+            'title' => ts('Contribution Page Title'),
             'name' => 'title',
             'default' => TRUE,
           ),
         ),
-        'filters' =>
-        array(
-          'page_title' =>
-          array('title' => ts('Contribution Page Title'),
+        'filters' => array(
+          'page_title' => array(
+            'title' => ts('Contribution Page Title'),
             'name' => 'title',
             'type' => CRM_Utils_Type::T_STRING,
           ),
         ),
         'grouping' => 'pcp-fields',
       ),
-      'civicrm_pcp' =>
-      array(
+      'civicrm_pcp' => array(
         'dao' => 'CRM_PCP_DAO_PCP',
-        'fields' =>
-        array(
-          'title' =>
-          array('title' => ts('Personal Campaign Title'),
+        'fields' => array(
+          'title' => array(
+            'title' => ts('Personal Campaign Title'),
             'default' => TRUE,
           ),
-          'goal_amount' =>
-          array('title' => ts('Goal Amount'),
+          'goal_amount' => array(
+            'title' => ts('Goal Amount'),
             'type' => CRM_Utils_Type::T_MONEY,
             'default' => TRUE,
           ),
         ),
-        'filters' =>
-        array(
-          'title' =>
-          array('title' => ts('Personal Campaign Title'),
+        'filters' => array(
+          'title' => array(
+            'title' => ts('Personal Campaign Title'),
             'type' => CRM_Utils_Type::T_STRING,
           ),
         ),
         'grouping' => 'pcp-fields',
       ),
-      'civicrm_contribution_soft' =>
-      array(
+      'civicrm_contribution_soft' => array(
         'dao' => 'CRM_Contribute_DAO_ContributionSoft',
-        'fields' =>
-        array(
-          'amount_1' =>
-          array('title' => ts('Committed Amount'),
+        'fields' => array(
+          'amount_1' => array(
+            'title' => ts('Committed Amount'),
             'name' => 'amount',
             'type' => CRM_Utils_Type::T_MONEY,
             'default' => TRUE,
-            'statistics' =>
-            array('sum' => ts('Committed Amount'),
+            'statistics' => array(
+              'sum' => ts('Committed Amount'),
             ),
           ),
-          'amount_2' =>
-          array('title' => ts('Amount Received'),
+          'amount_2' => array(
+            'title' => ts('Amount Received'),
             'name' => 'amount',
             'type' => CRM_Utils_Type::T_MONEY,
             'default' => TRUE,
             // nice trick with dbAlias
             'dbAlias' => 'SUM(IF( contribution_civireport.contribution_status_id > 1, 0, contribution_soft_civireport.amount))',
           ),
-          'soft_id' =>
-          array('title' => ts('Number of Donors'),
+          'soft_id' => array(
+            'title' => ts('Number of Donors'),
             'name' => 'id',
             'default' => TRUE,
-            'statistics' =>
-            array('count' => ts('Number of Donors'),
+            'statistics' => array(
+              'count' => ts('Number of Donors'),
             ),
           ),
         ),
-        'filters' =>
-        array(
-          'amount_2' =>
-          array('title' => ts('Amount Received'),
+        'filters' => array(
+          'amount_2' => array(
+            'title' => ts('Amount Received'),
             'type' => CRM_Utils_Type::T_MONEY,
             'dbAlias' => 'SUM(IF( contribution_civireport.contribution_status_id > 1, 0, contribution_soft_civireport.amount))',
           ),
         ),
         'grouping' => 'pcp-fields',
       ),
-      'civicrm_contribution' =>
-      array(
+      'civicrm_contribution' => array(
         'dao' => 'CRM_Contribute_DAO_Contribution',
-        'fields' =>
-        array(
-          'contribution_id' =>
-          array(
+        'fields' => array(
+          'contribution_id' => array(
             'name' => 'id',
             'no_display' => TRUE,
             'required' => TRUE,
           ),
-          'receive_date' =>
-          array('title' => ts('Most Recent Donation'),
+          'receive_date' => array(
+            'title' => ts('Most Recent Contribution'),
             'default' => TRUE,
-            'statistics' =>
-            array('max' => ts('Most Recent Donation'),
+            'statistics' => array(
+              'max' => ts('Most Recent Contribution'),
             ),
           ),
         ),
@@ -186,7 +174,7 @@ class CRM_Report_Form_Contribute_PCP extends CRM_Report_Form {
     parent::__construct();
   }
 
-  function from() {
+  public function from() {
     $this->_from = "
 FROM civicrm_pcp {$this->_aliases['civicrm_pcp']}
 
@@ -207,15 +195,15 @@ LEFT JOIN civicrm_contribution_page {$this->_aliases['civicrm_contribution_page'
              {$this->_aliases['civicrm_contribution_page']}.id";
   }
 
-  function groupBy() {
+  public function groupBy() {
     $this->_groupBy = "GROUP BY {$this->_aliases['civicrm_pcp']}.id";
   }
 
-  function orderBy() {
+  public function orderBy() {
     $this->_orderBy = " ORDER BY {$this->_aliases['civicrm_contact']}.sort_name ";
   }
 
-  function where() {
+  public function where() {
     $whereClauses = $havingClauses = array();
 
     foreach ($this->_columns as $tableName => $table) {
@@ -225,9 +213,9 @@ LEFT JOIN civicrm_contribution_page {$this->_aliases['civicrm_contribution_page'
 
           if (CRM_Utils_Array::value('type', $field) & CRM_Utils_Type::T_DATE) {
             $relative = CRM_Utils_Array::value("{$fieldName}_relative", $this->_params);
-            $from     = CRM_Utils_Array::value("{$fieldName}_from", $this->_params);
-            $to       = CRM_Utils_Array::value("{$fieldName}_to", $this->_params);
-            $clause   = $this->dateClause($field['name'], $relative, $from, $to, $field['type']);
+            $from = CRM_Utils_Array::value("{$fieldName}_from", $this->_params);
+            $to = CRM_Utils_Array::value("{$fieldName}_to", $this->_params);
+            $clause = $this->dateClause($field['name'], $relative, $from, $to, $field['type']);
           }
           else {
             $op = CRM_Utils_Array::value("{$fieldName}_op", $this->_params);
@@ -271,12 +259,18 @@ LEFT JOIN civicrm_contribution_page {$this->_aliases['civicrm_contribution_page'
     }
   }
 
-  function statistics(&$rows) {
+  /**
+   * @param $rows
+   *
+   * @return array
+   */
+  public function statistics(&$rows) {
     $statistics = parent::statistics($rows);
 
-    $select = "SELECT SUM({$this->_aliases['civicrm_pcp']}.goal_amount) as goal_total, ".
-      "SUM({$this->_aliases['civicrm_contribution_soft']}.amount) as committed_total, ".
-      "COUNT({$this->_aliases['civicrm_contribution_soft']}.id) as donors_total, ".
+    $select =
+      "SELECT SUM({$this->_aliases['civicrm_pcp']}.goal_amount) as goal_total, " .
+      "SUM({$this->_aliases['civicrm_contribution_soft']}.amount) as committed_total, " .
+      "COUNT({$this->_aliases['civicrm_contribution_soft']}.id) as donors_total, " .
       "SUM(IF( contribution_civireport.contribution_status_id > 1, 0, contribution_soft_civireport.amount)) AS received_total ";
     $sql = "{$select} {$this->_from} {$this->_where}";
     $dao = CRM_Core_DAO::executeQuery($sql);
@@ -303,7 +297,11 @@ LEFT JOIN civicrm_contribution_page {$this->_aliases['civicrm_contribution_page'
     );
     return $statistics;
   }
-  function alterDisplay(&$rows) {
+
+  /**
+   * @param $rows
+   */
+  public function alterDisplay(&$rows) {
     // custom code to alter rows
     $entryFound = FALSE;
     $checkList = array();