INFRA-132 comments to end with full stops
[civicrm-core.git] / CRM / Report / Form / Extended.php
index 18578f611bd4566b28dc5c91b40ac16d8f3f9a09..7effc2e17249e7223c8bd61797c7a2cb160625aa 100644 (file)
@@ -23,7 +23,7 @@
  | GNU Affero General Public License or the licensing of CiviCRM,     |
  | see the CiviCRM license FAQ at http://civicrm.org/licensing        |
  +--------------------------------------------------------------------+
-*/
+ */
 
 /**
  *
@@ -42,9 +42,6 @@ class CRM_Report_Form_Extended extends CRM_Report_Form {
   protected $_customGroupExtends = array();
   protected $_baseTable = 'civicrm_contact';
 
-  /**
-   *
-   */
   /**
    *
    */
@@ -52,16 +49,22 @@ class CRM_Report_Form_Extended extends CRM_Report_Form {
     parent::__construct();
   }
 
+  /**
+   *
+   */
   public function preProcess() {
     parent::preProcess();
   }
 
+  /**
+   *
+   */
   public function select() {
     parent::select();
   }
 
 
-  /*
+  /**
    * From clause build where baseTable & fromClauses are defined
    */
   public function from() {
@@ -79,10 +82,9 @@ class CRM_Report_Form_Extended extends CRM_Report_Form {
     }
   }
 
-  /*
-   * Define any from clauses in use (child classes to override)
-   */
   /**
+   * Define any from clauses in use (child classes to override)
+   *
    * @return array
    */
   public function fromClauses() {
@@ -110,7 +112,7 @@ class CRM_Report_Form_Extended extends CRM_Report_Form {
   }
 
   /**
-   * @param $rows
+   * @param array $rows
    *
    * @return array
    */
@@ -126,7 +128,13 @@ class CRM_Report_Form_Extended extends CRM_Report_Form {
   }
 
   /**
-   * @param $rows
+   * Alter display of rows.
+   *
+   * Iterate through the rows retrieved via SQL and make changes for display purposes,
+   * such as rendering contacts as links.
+   *
+   * @param array $rows
+   *   Rows generated by SQL, with an array for each row.
    */
   public function alterDisplay(&$rows) {
     parent::alterDisplay($rows);
@@ -248,12 +256,12 @@ class CRM_Report_Form_Extended extends CRM_Report_Form {
         // are grouped together across price sets but there may be a separate need to group
         // by id so that entries in one price set are distinct from others. Not quite sure what
         // to call the distinction for end users benefit
-          array(
-            'price_field_value_label' => array(
-              'title' => ts('Price Field Value Label'),
-              'name' => 'label',
-            ),
+        array(
+          'price_field_value_label' => array(
+            'title' => ts('Price Field Value Label'),
+            'name' => 'label',
           ),
+        ),
       ),
     );
   }
@@ -594,8 +602,7 @@ class CRM_Report_Form_Extended extends CRM_Report_Form {
         'filters' => array(
           'id' => array(
             'title' => ts('Contact ID'),
-          )
-        ,
+          ),
           'sort_name' => array(
             'title' => ts('Contact Name'),
           ),
@@ -696,31 +703,20 @@ class CRM_Report_Form_Extended extends CRM_Report_Form {
     );
   }
 
-  /*
-   * adding address fields to construct function in reports
-   * @param array $options
-   *   Options for the report.
-   * - prefix prefix to add (e.g. 'honor' when getting address details for honor contact
-   * - prefix_label optional prefix lable eg. "Honoree " for front end
-   * - group_by enable these fields for group by - default false
-   * - order_by enable these fields for order by
-   * - filters enable these fields for filtering
-   * - defaults - (is this working?) values to pre-populate
-   * @return array address fields for construct clause
-   */
   /**
-   * Get address columns to add to array
+   * Get address columns to add to array.
    *
    * @param array $options
-   *  - prefix Prefix to add to table (in case of more than one instance of the table)
-   *  - prefix_label Label to give columns from this address table instance
-   *
-   * @return array address columns definition
-   */
-  /**
-   * @param array $options
+   *   Options for the report.
+   *   - prefix prefix to add (e.g. 'honor' when getting address details for honor contact
+   *   - prefix_label optional prefix lable eg. "Honoree " for front end
+   *   - group_by enable these fields for group by - default false
+   *   - order_by enable these fields for order by
+   *   - filters enable these fields for filtering
+   *   - defaults - (is this working?) values to pre-populate
    *
    * @return array
+   *   address columns definition
    */
   public function getAddressColumns($options = array()) {
     $defaultOptions = array(
@@ -769,21 +765,18 @@ class CRM_Report_Form_Extended extends CRM_Report_Form {
             'title' => ts($options['prefix_label'] . 'Street Number'),
             'type' => 1,
             'default' => CRM_Utils_Array::value('street_number', $options['defaults'], FALSE),
-            'name' => 'street_number',
           ),
           $options['prefix'] . 'street_name' => array(
             'name' => 'street_name',
             'title' => ts($options['prefix_label'] . 'Street Name'),
             'type' => 1,
             'default' => CRM_Utils_Array::value('street_name', $options['defaults'], FALSE),
-            'name' => 'street_name',
           ),
           $options['prefix'] . 'street_unit' => array(
             'name' => 'street_unit',
             'title' => ts($options['prefix_label'] . 'Street Unit'),
             'type' => 1,
             'default' => CRM_Utils_Array::value('street_unit', $options['defaults'], FALSE),
-            'name' => 'street_unit',
           ),
           $options['prefix'] . 'city' => array(
             'title' => ts($options['prefix_label'] . 'City'),
@@ -921,10 +914,9 @@ class CRM_Report_Form_Extended extends CRM_Report_Form {
     return $addressFields;
   }
 
-  /*
-   * Get Information about advertised Joins
-   */
   /**
+   * Get Information about advertised Joins.
+   *
    * @return array
    */
   public function getAvailableJoins() {
@@ -1012,11 +1004,10 @@ class CRM_Report_Form_Extended extends CRM_Report_Form {
     );
   }
 
-  /*
+  /**
    * Add join from contact table to address. Prefix will be added to both tables
    * as it's assumed you are using it to get address of a secondary contact
-   */
-  /**
+   *
    * @param string $prefix
    */
   public function joinAddressFromContact($prefix = '') {
@@ -1039,8 +1030,8 @@ class CRM_Report_Form_Extended extends CRM_Report_Form {
      ";
   }
 
-  /*
-   * Define join from line item table to participant table
+  /**
+   * Define join from line item table to participant table.
    */
   public function joinParticipantFromLineItem() {
     $this->_from .= " LEFT JOIN civicrm_participant {$this->_aliases['civicrm_participant']}
@@ -1049,7 +1040,7 @@ class CRM_Report_Form_Extended extends CRM_Report_Form {
     ";
   }
 
-  /*
+  /**
    * Define join from line item table to Membership table. Seems to be still via contribution
    * as the entity. Have made 'inner' to restrict does that make sense?
    */
@@ -1064,8 +1055,8 @@ class CRM_Report_Form_Extended extends CRM_Report_Form {
     ";
   }
 
-  /*
-   * Define join from Participant to Contribution table
+  /**
+   * Define join from Participant to Contribution table.
    */
   public function joinContributionFromParticipant() {
     $this->_from .= " LEFT JOIN civicrm_participant_payment pp
@@ -1075,8 +1066,8 @@ class CRM_Report_Form_Extended extends CRM_Report_Form {
       ";
   }
 
-  /*
-   * Define join from Membership to Contribution table
+  /**
+   * Define join from Membership to Contribution table.
    */
   public function joinContributionFromMembership() {
     $this->_from .= " LEFT JOIN civicrm_membership_payment pp
@@ -1226,18 +1217,17 @@ WHERE   line_item_civireport.id IS NOT NULL
                         {$this->_aliases['civicrm_event']}.is_template = 0)";
   }
 
-  /*
-    * Retrieve text for financial type from pseudoconstant
-    */
   /**
+   * Retrieve text for financial type from pseudoconstant.
+   *
    * @param $value
-   * @param $row
+   * @param array $row
    *
    * @return string
    */
   public function alterNickName($value, &$row) {
     if (empty($row['civicrm_contact_id'])) {
-      return;
+      return NULL;
     }
     $contactID = $row['civicrm_contact_id'];
     return "<div id=contact-{$contactID} class='crm-entity'>
@@ -1245,12 +1235,11 @@ WHERE   line_item_civireport.id IS NOT NULL
            " . $value . "</span></div>";
   }
 
-  /*
-   * Retrieve text for contribution type from pseudoconstant
-   */
   /**
+   * Retrieve text for contribution type from pseudoconstant.
+   *
    * @param $value
-   * @param $row
+   * @param array $row
    *
    * @return array|string
    */
@@ -1258,12 +1247,11 @@ WHERE   line_item_civireport.id IS NOT NULL
     return is_string(CRM_Contribute_PseudoConstant::financialType($value, FALSE)) ? CRM_Contribute_PseudoConstant::financialType($value, FALSE) : '';
   }
 
-  /*
-   * Retrieve text for contribution status from pseudoconstant
-   */
   /**
+   * Retrieve text for contribution status from pseudoconstant.
+   *
    * @param $value
-   * @param $row
+   * @param array $row
    *
    * @return array
    */
@@ -1271,12 +1259,11 @@ WHERE   line_item_civireport.id IS NOT NULL
     return CRM_Contribute_PseudoConstant::contributionStatus($value);
   }
 
-  /*
-   * Retrieve text for payment instrument from pseudoconstant
-   */
   /**
+   * Retrieve text for payment instrument from pseudoconstant.
+   *
    * @param $value
-   * @param $row
+   * @param array $row
    *
    * @return array
    */
@@ -1286,7 +1273,7 @@ WHERE   line_item_civireport.id IS NOT NULL
 
   /**
    * @param $value
-   * @param $row
+   * @param array $row
    *
    * @return array|string
    */
@@ -1296,7 +1283,7 @@ WHERE   line_item_civireport.id IS NOT NULL
 
   /**
    * @param $value
-   * @param $row
+   * @param array $row
    *
    * @return array|string
    */
@@ -1306,7 +1293,7 @@ WHERE   line_item_civireport.id IS NOT NULL
 
   /**
    * @param $value
-   * @param $row
+   * @param array $row
    *
    * @return array|string
    */
@@ -1316,7 +1303,7 @@ WHERE   line_item_civireport.id IS NOT NULL
 
   /**
    * @param $value
-   * @param $row
+   * @param array $row
    * @param $selectedfield
    * @param string $criteriaFieldName
    *
@@ -1335,7 +1322,7 @@ WHERE   line_item_civireport.id IS NOT NULL
 
   /**
    * @param $value
-   * @param $row
+   * @param array $row
    * @param $selectedfield
    * @param string $criteriaFieldName
    *
@@ -1354,7 +1341,7 @@ WHERE   line_item_civireport.id IS NOT NULL
 
   /**
    * @param $value
-   * @param $row
+   * @param array $row
    * @param $selectedfield
    * @param string $criteriaFieldName
    *
@@ -1374,7 +1361,7 @@ WHERE   line_item_civireport.id IS NOT NULL
 
   /**
    * @param $value
-   * @param $row
+   * @param array $row
    * @param string $fieldname
    *
    * @return mixed
@@ -1392,7 +1379,7 @@ WHERE   line_item_civireport.id IS NOT NULL
    */
   public function alterParticipantStatus($value) {
     if (empty($value)) {
-      return;
+      return NULL;
     }
     return CRM_Event_PseudoConstant::participantStatus($value, FALSE, 'label');
   }
@@ -1400,11 +1387,11 @@ WHERE   line_item_civireport.id IS NOT NULL
   /**
    * @param $value
    *
-   * @return string
+   * @return string|void
    */
   public function alterParticipantRole($value) {
     if (empty($value)) {
-      return;
+      return NULL;
     }
     $roles = explode(CRM_Core_DAO::VALUE_SEPARATOR, $value);
     $value = array();
@@ -1423,4 +1410,5 @@ WHERE   line_item_civireport.id IS NOT NULL
     $paymentInstruments = CRM_Contribute_PseudoConstant::paymentInstrument();
     return $paymentInstruments[$value];
   }
+
 }