Merge remote-tracking branch 'upstream/4.6' into 4.6-master-2015-04-20-23-29-59
[civicrm-core.git] / CRM / Utils / Hook.php
index 6a1d710cf0a2fa7d089d5e93f9fe159f074867ac..915f8309431192acfcdb73fedf938ff603944b51 100644 (file)
@@ -3,7 +3,7 @@
  +--------------------------------------------------------------------+
  | CiviCRM version 4.6                                                |
  +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2014                                |
+ | Copyright CiviCRM LLC (c) 2004-2015                                |
  +--------------------------------------------------------------------+
  | This file is a part of CiviCRM.                                    |
  |                                                                    |
  | GNU Affero General Public License or the licensing of CiviCRM,     |
  | see the CiviCRM license FAQ at http://civicrm.org/licensing        |
  +--------------------------------------------------------------------+
-*/
+ */
 
 /**
  *
  * @package CiviCRM_Hook
- * @copyright CiviCRM LLC (c) 2004-2014
+ * @copyright CiviCRM LLC (c) 2004-2015
  * $Id: $
  *
  */
-
 abstract class CRM_Utils_Hook {
 
   // Allowed values for dashboard hook content placement
@@ -57,7 +56,6 @@ abstract class CRM_Utils_Hook {
    * pattern and cache the instance in this variable
    *
    * @var object
-   * @static
    */
   static private $_singleton = NULL;
 
@@ -72,7 +70,7 @@ abstract class CRM_Utils_Hook {
   private $commonCiviModules = array();
 
   /**
-   * Constructor and getter for the singleton instance
+   * Constructor and getter for the singleton instance.
    *
    * @param bool $fresh
    *
@@ -90,7 +88,7 @@ abstract class CRM_Utils_Hook {
   }
 
   /**
-   * Invoke hooks
+   * Invoke hooks.
    *
    * @param int $numParams
    *   Number of parameters to pass to the hook.
@@ -111,7 +109,7 @@ abstract class CRM_Utils_Hook {
    *
    * @return mixed
    */
-  abstract function invoke(
+  public abstract function invoke(
     $numParams,
     &$arg1, &$arg2, &$arg3, &$arg4, &$arg5, &$arg6,
     $fnSuffix
@@ -130,7 +128,7 @@ abstract class CRM_Utils_Hook {
    *
    * @return array|bool
    */
-  function commonInvoke(
+  public function commonInvoke(
     $numParams,
     &$arg1, &$arg2, &$arg3, &$arg4, &$arg5, &$arg6,
     $fnSuffix, $fnPrefix
@@ -181,7 +179,7 @@ abstract class CRM_Utils_Hook {
    *
    * @return array|bool
    */
-  function runHooks(
+  public function runHooks(
     $civiModules, $fnSuffix, $numParams,
     &$arg1, &$arg2, &$arg3, &$arg4, &$arg5, &$arg6
   ) {
@@ -231,7 +229,8 @@ abstract class CRM_Utils_Hook {
           }
 
           if (!empty($fResult) &&
-            is_array($fResult)) {
+            is_array($fResult)
+          ) {
             $result = array_merge($result, $fResult);
           }
         }
@@ -272,13 +271,15 @@ abstract class CRM_Utils_Hook {
    * @param array $params
    *   The parameters used for object creation / editing.
    *
-   * @return null the return value is ignored
+   * @return null
+   *   the return value is ignored
    */
   public static function pre($op, $objectName, $id, &$params) {
     $event = new \Civi\Core\Event\PreEvent($op, $objectName, $id, $params);
     \Civi\Core\Container::singleton()->get('dispatcher')->dispatch("hook_civicrm_pre", $event);
     \Civi\Core\Container::singleton()->get('dispatcher')->dispatch("hook_civicrm_pre::$objectName", $event);
-    return self::singleton()->invoke(4, $op, $objectName, $id, $params, self::$_nullObject, self::$_nullObject, 'civicrm_pre');
+    return self::singleton()
+      ->invoke(4, $op, $objectName, $id, $params, self::$_nullObject, self::$_nullObject, 'civicrm_pre');
   }
 
   /**
@@ -293,18 +294,20 @@ abstract class CRM_Utils_Hook {
    * @param object $objectRef
    *   The reference to the object if available.
    *
-   * @return mixed             based on op. pre-hooks return a boolean or
+   * @return mixed
+   *   based on op. pre-hooks return a boolean or
    *                           an error message which aborts the operation
    */
   public static function post($op, $objectName, $objectId, &$objectRef) {
     $event = new \Civi\Core\Event\PostEvent($op, $objectName, $objectId, $objectRef);
     \Civi\Core\Container::singleton()->get('dispatcher')->dispatch("hook_civicrm_post", $event);
     \Civi\Core\Container::singleton()->get('dispatcher')->dispatch("hook_civicrm_post::$objectName", $event);
-    return self::singleton()->invoke(4, $op, $objectName, $objectId, $objectRef, self::$_nullObject, self::$_nullObject, 'civicrm_post');
+    return self::singleton()
+      ->invoke(4, $op, $objectName, $objectId, $objectRef, self::$_nullObject, self::$_nullObject, 'civicrm_post');
   }
 
   /**
-   * This hook retrieves links from other modules and injects it into
+   * This hook retrieves links from other modules and injects it into.
    * the view contact tabs
    *
    * @param string $op
@@ -320,7 +323,8 @@ abstract class CRM_Utils_Hook {
    * @param array $values
    *   (optional) the values to fill the links.
    *
-   * @return null  the return value is ignored
+   * @return null
+   *   the return value is ignored
    */
   public static function links($op, $objectName, &$objectId, &$links, &$mask = NULL, &$values = array()) {
     return self::singleton()->invoke(6, $op, $objectName, $objectId, $links, $mask, $values, 'civicrm_links');
@@ -334,10 +338,12 @@ abstract class CRM_Utils_Hook {
    * @param CRM_Core_Form $form
    *   Reference to the form object.
    *
-   * @return null the return value is ignored
+   * @return null
+   *   the return value is ignored
    */
   public static function preProcess($formName, &$form) {
-    return self::singleton()->invoke(2, $formName, $form, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, 'civicrm_preProcess');
+    return self::singleton()
+      ->invoke(2, $formName, $form, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, 'civicrm_preProcess');
   }
 
   /**
@@ -349,10 +355,14 @@ abstract class CRM_Utils_Hook {
    * @param CRM_Core_Form $form
    *   Reference to the form object.
    *
-   * @return null the return value is ignored
+   * @return null
+   *   the return value is ignored
    */
   public static function buildForm($formName, &$form) {
-    return self::singleton()->invoke(2, $formName, $form, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, 'civicrm_buildForm');
+    return self::singleton()->invoke(2, $formName, $form,
+      self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject,
+      'civicrm_buildForm'
+    );
   }
 
   /**
@@ -364,10 +374,14 @@ abstract class CRM_Utils_Hook {
    * @param CRM_Core_Form $form
    *   Reference to the form object.
    *
-   * @return null the return value is ignored
+   * @return null
+   *   the return value is ignored
    */
   public static function postProcess($formName, &$form) {
-    return self::singleton()->invoke(2, $formName, $form, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, 'civicrm_postProcess');
+    return self::singleton()->invoke(2, $formName, $form,
+      self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject,
+      'civicrm_postProcess'
+    );
   }
 
   /**
@@ -380,11 +394,13 @@ abstract class CRM_Utils_Hook {
    * @param array &$files the FILES parameters as sent in by POST
    * @param array &$form the form object
    *
-   * @return mixed             formRule hooks return a boolean or
+   * @return mixed
+   *   formRule hooks return a boolean or
    *                           an array of error messages which display a QF Error
    */
   public static function validate($formName, &$fields, &$files, &$form) {
-    return self::singleton()->invoke(4, $formName, $fields, $files, $form, self::$_nullObject, self::$_nullObject, 'civicrm_validate');
+    return self::singleton()
+      ->invoke(4, $formName, $fields, $files, $form, self::$_nullObject, self::$_nullObject, 'civicrm_validate');
   }
 
   /**
@@ -398,15 +414,17 @@ abstract class CRM_Utils_Hook {
    * @param array &$form the form object
    * @param array &$errors the array of errors.
    *
-   * @return mixed             formRule hooks return a boolean or
+   * @return mixed
+   *   formRule hooks return a boolean or
    *                           an array of error messages which display a QF Error
    */
   public static function validateForm($formName, &$fields, &$files, &$form, &$errors) {
-    return self::singleton()->invoke(5, $formName, $fields, $files, $form, $errors, self::$_nullObject, 'civicrm_validateForm');
+    return self::singleton()
+      ->invoke(5, $formName, $fields, $files, $form, $errors, self::$_nullObject, 'civicrm_validateForm');
   }
 
   /**
-   * This hook is called before a db write on a custom table
+   * This hook is called after a db write on a custom table.
    *
    * @param string $op
    *   The type of operation being performed.
@@ -417,10 +435,12 @@ abstract class CRM_Utils_Hook {
    * @param array $params
    *   The parameters that were sent into the calling function.
    *
-   * @return null the return value is ignored
+   * @return null
+   *   the return value is ignored
    */
   public static function custom($op, $groupID, $entityID, &$params) {
-    return self::singleton()->invoke(4, $op, $groupID, $entityID, $params, self::$_nullObject, self::$_nullObject, 'civicrm_custom');
+    return self::singleton()
+      ->invoke(4, $op, $groupID, $entityID, $params, self::$_nullObject, self::$_nullObject, 'civicrm_custom');
   }
 
   /**
@@ -438,10 +458,12 @@ abstract class CRM_Utils_Hook {
    * @param string $where
    *   The currrent where clause.
    *
-   * @return null the return value is ignored
+   * @return null
+   *   the return value is ignored
    */
   public static function aclWhereClause($type, &$tables, &$whereTables, &$contactID, &$where) {
-    return self::singleton()->invoke(5, $type, $tables, $whereTables, $contactID, $where, self::$_nullObject, 'civicrm_aclWhereClause');
+    return self::singleton()
+      ->invoke(5, $type, $tables, $whereTables, $contactID, $where, self::$_nullObject, 'civicrm_aclWhereClause');
   }
 
   /**
@@ -459,19 +481,22 @@ abstract class CRM_Utils_Hook {
    * @param array $currentGroups
    *   The set of objects that are currently permissioned for this contact.
    *
-   * @return null the return value is ignored
+   * @return null
+   *   the return value is ignored
    */
   public static function aclGroup($type, $contactID, $tableName, &$allGroups, &$currentGroups) {
-    return self::singleton()->invoke(5, $type, $contactID, $tableName, $allGroups, $currentGroups, self::$_nullObject, 'civicrm_aclGroup');
+    return self::singleton()
+      ->invoke(5, $type, $contactID, $tableName, $allGroups, $currentGroups, self::$_nullObject, 'civicrm_aclGroup');
   }
 
   /**
-   * This hook is called when building the menu table
+   * This hook is called when building the menu table.
    *
    * @param array $files
    *   The current set of files to process.
    *
-   * @return null the return value is ignored
+   * @return null
+   *   the return value is ignored
    */
   public static function xmlMenu(&$files) {
     return self::singleton()->invoke(1, $files,
@@ -481,12 +506,24 @@ abstract class CRM_Utils_Hook {
   }
 
   /**
-   * This hook is called for declaring managed entities via API
+   * This hook is called for declaring managed entities via API.
    *
    * @param array $entities
-   *   List of pending entities.
+   *   List of pending entities. Each entity is an array with keys:
+   *   + 'module': string; for module-extensions, this is the fully-qualifed name (e.g. "com.example.mymodule"); for CMS modules, the name is prefixed by the CMS (e.g. "drupal.mymodule")
+   *   + 'name': string, a symbolic name which can be used to track this entity (Note: Each module creates its own namespace)
+   *   + 'entity': string, an entity-type supported by the CiviCRM API (Note: this currently must be an entity which supports the 'is_active' property)
+   *   + 'params': array, the entity data as supported by the CiviCRM API
+   *   + 'update' (v4.5+): string, a policy which describes when to update records
+   *     - 'always' (default): always update the managed-entity record; changes in $entities will override any local changes (eg by the site-admin)
+   *     - 'never': never update the managed-entity record; changes made locally (eg by the site-admin) will override changes in $entities
+   *   + 'cleanup' (v4.5+): string, a policy which describes whether to cleanup the record when it becomes orphaned (ie when $entities no longer references the record)
+   *     - 'always' (default): always delete orphaned records
+   *     - 'never': never delete orphaned records
+   *     - 'unused': only delete orphaned records if there are no other references to it in the DB. (This is determined by calling the API's "getrefcount" action.)
    *
-   * @return null the return value is ignored
+   * @return null
+   *   the return value is ignored
    */
   public static function managed(&$entities) {
     return self::singleton()->invoke(1, $entities,
@@ -504,7 +541,8 @@ abstract class CRM_Utils_Hook {
    *   (output parameter) where should the hook content be displayed.
    * relative to the activity list
    *
-   * @return string the html snippet to include in the dashboard
+   * @return string
+   *   the html snippet to include in the dashboard
    */
   public static function dashboard($contactID, &$contentPlacement = self::DASHBOARD_BELOW) {
     $retval = self::singleton()->invoke(2, $contactID, $contentPlacement,
@@ -540,16 +578,18 @@ abstract class CRM_Utils_Hook {
   }
 
   /**
-   * Determine how many other records refer to a given record
+   * Determine how many other records refer to a given record.
    *
    * @param CRM_Core_DAO $dao
    *   The item for which we want a reference count.
    * @param array $refCounts
-   *   Each item in the array is an array with keys:.
+   *   Each item in the array is an Array with keys:
    *   - name: string, eg "sql:civicrm_email:contact_id"
    *   - type: string, eg "sql"
    *   - count: int, eg "5" if there are 5 email addresses that refer to $dao
-   * @return void
+   *
+   * @return mixed
+   *   Return is not really intended to be used.
    */
   public static function referenceCounts($dao, &$refCounts) {
     return self::singleton()->invoke(2, $dao, $refCounts,
@@ -559,7 +599,7 @@ abstract class CRM_Utils_Hook {
   }
 
   /**
-   * This hook is called when building the amount structure for a Contribution or Event Page
+   * This hook is called when building the amount structure for a Contribution or Event Page.
    *
    * @param int $pageType
    *   Is this a contribution or event page.
@@ -657,14 +697,15 @@ abstract class CRM_Utils_Hook {
    *
    * @return null
    */
-  static function tokenValues(
+  public static function tokenValues(
     &$details,
     $contactIDs,
     $jobID = NULL,
     $tokens = array(),
     $className = NULL
   ) {
-    return self::singleton()->invoke(5, $details, $contactIDs, $jobID, $tokens, $className, self::$_nullObject, 'civicrm_tokenValues');
+    return self::singleton()
+      ->invoke(5, $details, $contactIDs, $jobID, $tokens, $className, self::$_nullObject, 'civicrm_tokenValues');
   }
 
   /**
@@ -720,7 +761,8 @@ abstract class CRM_Utils_Hook {
    * @return mixed
    */
   public static function unsubscribeGroups($op, $mailingId, $contactId, &$groups, &$baseGroups) {
-    return self::singleton()->invoke(5, $op, $mailingId, $contactId, $groups, $baseGroups, self::$_nullObject, 'civicrm_unsubscribeGroups');
+    return self::singleton()
+      ->invoke(5, $op, $mailingId, $contactId, $groups, $baseGroups, self::$_nullObject, 'civicrm_unsubscribeGroups');
   }
 
   /**
@@ -830,7 +872,7 @@ abstract class CRM_Utils_Hook {
   }
 
   /**
-   * This hook is called when rendering the contact summary
+   * This hook is called when rendering the contact summary.
    *
    * @param int $contactID
    *   The contactID for whom the summary is being rendered
@@ -885,19 +927,24 @@ abstract class CRM_Utils_Hook {
    *
    * Definition will look like this:
    *
-   *   function hook_civicrm_alterPaymentProcessorParams($paymentObj,
-   *                                                     &$rawParams, &$cookedParams);
+   *   function hook_civicrm_alterPaymentProcessorParams(
+   *     $paymentObj,
+   *     &$rawParams,
+   *     &$cookedParams
+   *   );
    *
-   * @param string $paymentObj
-   *    instance of payment class of the payment processor invoked (e.g., 'CRM_Core_Payment_Dummy')
+   * @param CRM_Core_Payment $paymentObj
+   *   Instance of payment class of the payment processor invoked (e.g., 'CRM_Core_Payment_Dummy')
+   *   See discussion in CRM-16224 as to whether $paymentObj should be passed by reference.
    * @param array &$rawParams
    *    array of params as passed to to the processor
    * @param array &$cookedParams
    *     params after the processor code has translated them into its own key/value pairs
    *
    * @return mixed
+   *   This return is not really intended to be used.
    */
-  static function alterPaymentProcessorParams(
+  public static function alterPaymentProcessorParams(
     $paymentObj,
     &$rawParams,
     &$cookedParams
@@ -913,7 +960,7 @@ abstract class CRM_Utils_Hook {
    *
    * @param array $params
    *   Array fields include: groupName, from, toName, toEmail, subject, cc, bcc, text, html,
-   * returnPath, replyTo, headers, attachments (array)
+   *   returnPath, replyTo, headers, attachments (array)
    * @param string $context
    *   The context in which the hook is being invoked, eg 'civimail'.
    *
@@ -927,7 +974,7 @@ abstract class CRM_Utils_Hook {
   }
 
   /**
-   * This hook is called when membership status is being calculated
+   * This hook is called when membership status is being calculated.
    *
    * @param array $membershipStatus
    *   Membership status details as determined - alter if required.
@@ -952,13 +999,14 @@ abstract class CRM_Utils_Hook {
   }
 
   /**
-   * This hook is called when rendering the Manage Case screen
+   * This hook is called when rendering the Manage Case screen.
    *
    * @param int $caseID
    *   The case ID.
    *
-   * @return array of data to be displayed, where the key is a unique id to be used for styling (div id's)
-   * and the value is an array with keys 'label' and 'value' specifying label/value pairs
+   * @return array
+   *   Array of data to be displayed, where the key is a unique id to be used for styling (div id's)
+   *   and the value is an array with keys 'label' and 'value' specifying label/value pairs
    */
   public static function caseSummary($caseID) {
     return self::singleton()->invoke(1, $caseID,
@@ -975,7 +1023,8 @@ abstract class CRM_Utils_Hook {
    * @return mixed
    */
   public static function caseTypes(&$caseTypes) {
-    return self::singleton()->invoke(1, $caseTypes, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, 'civicrm_caseTypes');
+    return self::singleton()
+      ->invoke(1, $caseTypes, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, 'civicrm_caseTypes');
   }
 
   /**
@@ -995,21 +1044,7 @@ abstract class CRM_Utils_Hook {
   }
 
   /**
-   * @param $recordBAO
-   * @param int $recordID
-   * @param $isActive
-   *
-   * @return mixed
-   */
-  public static function enableDisable($recordBAO, $recordID, $isActive) {
-    return self::singleton()->invoke(3, $recordBAO, $recordID, $isActive,
-      self::$_nullObject, self::$_nullObject, self::$_nullObject,
-      'civicrm_enableDisable'
-    );
-  }
-
-  /**
-   * This hooks allows to change option values
+   * This hooks allows to change option values.
    *
    * @param array $options
    *   Associated array of option values / id
@@ -1076,7 +1111,7 @@ abstract class CRM_Utils_Hook {
   }
 
   /**
-   * This hook is called before record is exported as CSV
+   * This hook is called before record is exported as CSV.
    *
    * @param string $exportTempTable
    *   Name of the temporary export table used during export.
@@ -1130,7 +1165,8 @@ abstract class CRM_Utils_Hook {
    * @return mixed
    */
   public static function emailProcessor($type, &$params, $mail, &$result, $action = NULL) {
-    return self::singleton()->invoke(5, $type, $params, $mail, $result, $action, self::$_nullObject, 'civicrm_emailProcessor');
+    return self::singleton()
+      ->invoke(5, $type, $params, $mail, $result, $action, self::$_nullObject, 'civicrm_emailProcessor');
   }
 
   /**
@@ -1226,11 +1262,11 @@ abstract class CRM_Utils_Hook {
    *                           activity, campaign, case, contact, contribution, event, grant, membership, and pledge
    * @param array &$headers the list of column headers, an associative array with keys: ( name, sort, order )
    * @param array &$rows the list of values, an associate array with fields that are displayed for that component
-   * @param $selector
+   * @param array $selector
+   *   the selector object. Allows you access to the context of the search
    *
-   * @internal param array $seletor the selector object. Allows you access to the context of the search
-   *
-   * @return void  modify the header and values object to pass the data u need
+   * @return void
+   *   modify the header and values object to pass the data u need
    */
   public static function searchColumns($objectName, &$headers, &$rows, &$selector) {
     return self::singleton()->invoke(4, $objectName, $headers, $rows, $selector,
@@ -1282,7 +1318,7 @@ abstract class CRM_Utils_Hook {
   }
 
   /**
-   * Hook definition for altering the generation of Mailing Labels
+   * Hook definition for altering the generation of Mailing Labels.
    *
    * @param array $args
    *   An array of the args in the order defined for the tcpdf multiCell api call.
@@ -1323,7 +1359,7 @@ abstract class CRM_Utils_Hook {
   }
 
   /**
-   * This hooks allows alteration of generated page content
+   * This hooks allows alteration of generated page content.
    *
    * @param $content
    *   Previously generated content.
@@ -1366,7 +1402,7 @@ abstract class CRM_Utils_Hook {
   }
 
   /**
-   * This hook collects the trigger definition from all components
+   * This hook collects the trigger definition from all components.
    *
    * @param $info
    * @param string $tableName
@@ -1498,7 +1534,7 @@ abstract class CRM_Utils_Hook {
   }
 
   /**
-   * This hook is called when Settings specifications are loaded
+   * This hook is called when Settings specifications are loaded.
    *
    * @param array $settingsFolders
    *   List of paths from which to derive metadata
@@ -1507,9 +1543,9 @@ abstract class CRM_Utils_Hook {
    */
   public static function alterSettingsFolders(&$settingsFolders) {
     return self::singleton()->invoke(1, $settingsFolders,
-        self::$_nullObject, self::$_nullObject,
-        self::$_nullObject, self::$_nullObject, self::$_nullObject,
-        'civicrm_alterSettingsFolders'
+      self::$_nullObject, self::$_nullObject,
+      self::$_nullObject, self::$_nullObject, self::$_nullObject,
+      'civicrm_alterSettingsFolders'
     );
   }
 
@@ -1526,9 +1562,9 @@ abstract class CRM_Utils_Hook {
    */
   public static function alterSettingsMetaData(&$settingsMetaData, $domainID, $profile) {
     return self::singleton()->invoke(3, $settingsMetaData,
-        $domainID, $profile,
-        self::$_nullObject, self::$_nullObject, self::$_nullObject,
-        'civicrm_alterSettingsMetaData'
+      $domainID, $profile,
+      self::$_nullObject, self::$_nullObject, self::$_nullObject,
+      'civicrm_alterSettingsMetaData'
     );
   }
 
@@ -1545,8 +1581,8 @@ abstract class CRM_Utils_Hook {
   public static function apiWrappers(&$wrappers, $apiRequest) {
     return self::singleton()
       ->invoke(2, $wrappers, $apiRequest, self::$_nullObject, self::$_nullObject, self::$_nullObject,
-      self::$_nullObject, 'civicrm_apiWrappers'
-    );
+        self::$_nullObject, 'civicrm_apiWrappers'
+      );
   }
 
   /**
@@ -1587,8 +1623,9 @@ abstract class CRM_Utils_Hook {
    * @param mixed $request
    *   Reserved for future use.
    */
-  static function unhandledException($exception, $request = NULL) {
-    self::singleton()->invoke(2, $exception, $request, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, 'civicrm_unhandled_exception');
+  public static function unhandledException($exception, $request = NULL) {
+    self::singleton()
+      ->invoke(2, $exception, $request, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, 'civicrm_unhandled_exception');
     // == 4.4 ==
     //$event = new stdClass();
     //$event->exception = $exception;
@@ -1600,7 +1637,7 @@ abstract class CRM_Utils_Hook {
   }
 
   /**
-   * This hook is called for declaring managed entities via API
+   * This hook is called for declaring managed entities via API.
    *
    * @param array[] $entityTypes
    *   List of entity types; each entity-type is an array with keys:
@@ -1618,7 +1655,7 @@ abstract class CRM_Utils_Hook {
   }
 
   /**
-   * This hook is called while preparing a profile form
+   * This hook is called while preparing a profile form.
    *
    * @param string $name
    * @return mixed
@@ -1629,7 +1666,7 @@ abstract class CRM_Utils_Hook {
   }
 
   /**
-   * This hook is called while validating a profile form submission
+   * This hook is called while validating a profile form submission.
    *
    * @param string $name
    * @return mixed
@@ -1640,7 +1677,7 @@ abstract class CRM_Utils_Hook {
   }
 
   /**
-   * This hook is called processing a valid profile form submission
+   * This hook is called processing a valid profile form submission.
    *
    * @param string $name
    * @return mixed
@@ -1684,15 +1721,17 @@ abstract class CRM_Utils_Hook {
    * @param array $participant
    *   Array of participant values.
    *
-   * @return null the return value is ignored
+   * @return null
+   *   the return value is ignored
    */
   public static function alterBadge($labelName, &$label, &$format, &$participant) {
-    return self::singleton()->invoke(4, $labelName, $label, $format, $participant, self::$_nullObject, self::$_nullObject, 'civicrm_alterBadge');
+    return self::singleton()
+      ->invoke(4, $labelName, $label, $format, $participant, self::$_nullObject, self::$_nullObject, 'civicrm_alterBadge');
   }
 
 
   /**
-   * This hook is called before encoding data in barcode
+   * This hook is called before encoding data in barcode.
    *
    * @param array $data
    *   Associated array of values available for encoding.
@@ -1736,11 +1775,12 @@ abstract class CRM_Utils_Hook {
    * @return mixed
    */
   public static function queryObjects(&$queryObjects, $type = 'Contact') {
-    return self::singleton()->invoke(2, $queryObjects, $type, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, 'civicrm_queryObjects');
+    return self::singleton()
+      ->invoke(2, $queryObjects, $type, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, 'civicrm_queryObjects');
   }
 
   /**
-   * This hook is called while viewing contact dashboard
+   * This hook is called while viewing contact dashboard.
    *
    * @param array $availableDashlets
    *   List of dashlets; each is formatted per api/v3/Dashboard
@@ -1750,7 +1790,8 @@ abstract class CRM_Utils_Hook {
    * @return mixed
    */
   public static function dashboard_defaults($availableDashlets, &$defaultDashlets) {
-    return self::singleton()->invoke(2, $availableDashlets, $defaultDashlets, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, 'civicrm_dashboard_defaults');
+    return self::singleton()
+      ->invoke(2, $availableDashlets, $defaultDashlets, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, 'civicrm_dashboard_defaults');
   }
 
   /**
@@ -1765,7 +1806,8 @@ abstract class CRM_Utils_Hook {
    * @return void
    */
   public static function pre_case_merge($mainContactId, $mainCaseId = NULL, $otherContactId = NULL, $otherCaseId = NULL, $changeClient = FALSE) {
-    return self::singleton()->invoke(5, $mainContactId, $mainCaseId, $otherContactId, $otherCaseId, $changeClient, self::$_nullObject, 'civicrm_pre_case_merge');
+    return self::singleton()
+      ->invoke(5, $mainContactId, $mainCaseId, $otherContactId, $otherCaseId, $changeClient, self::$_nullObject, 'civicrm_pre_case_merge');
   }
 
   /**
@@ -1780,7 +1822,8 @@ abstract class CRM_Utils_Hook {
    * @return void
    */
   public static function post_case_merge($mainContactId, $mainCaseId = NULL, $otherContactId = NULL, $otherCaseId = NULL, $changeClient = FALSE) {
-    return self::singleton()->invoke(5, $mainContactId, $mainCaseId, $otherContactId, $otherCaseId, $changeClient, self::$_nullObject, 'civicrm_post_case_merge');
+    return self::singleton()
+      ->invoke(5, $mainContactId, $mainCaseId, $otherContactId, $otherCaseId, $changeClient, self::$_nullObject, 'civicrm_post_case_merge');
   }
 
   /**
@@ -1808,12 +1851,21 @@ abstract class CRM_Utils_Hook {
    *
    * @param array $angularModules
    *   List of modules.
-   * @return null the return value is ignored
+   * @return null
+   *   the return value is ignored
    *
    * @code
    * function mymod_civicrm_angularModules(&$angularModules) {
-   *   $angularModules['myAngularModule'] = array('ext' => 'org.example.mymod', 'js' => array('js/myAngularModule.js'));
-   *   $angularModules['myBigAngularModule'] = array('ext' => 'org.example.mymod', 'js' => array('js/part1.js', 'js/part2.js'), 'css' => array('css/myAngularModule.css'));
+   *   $angularModules['myAngularModule'] = array(
+   *     'ext' => 'org.example.mymod',
+   *     'js' => array('js/myAngularModule.js'),
+   *   );
+   *   $angularModules['myBigAngularModule'] = array(
+   *     'ext' => 'org.example.mymod',
+   *     'js' => array('js/part1.js', 'js/part2.js'),
+   *     'css' => array('css/myAngularModule.css'),
+   *     'partials' => array('partials/myBigAngularModule'),
+   *   );
    * }
    * @endcode
    */
@@ -1840,7 +1892,7 @@ abstract class CRM_Utils_Hook {
   }
 
   /**
-   * Generate a default CRUD URL for an entity
+   * Generate a default CRUD URL for an entity.
    *
    * @param array $spec
    *   With keys:.
@@ -1850,10 +1902,10 @@ abstract class CRM_Utils_Hook {
    * @param CRM_Core_DAO $bao
    * @param array $link
    *   To define the link, add these keys to $link:.
-   *  - title: string
-   *  - path: string
-   *  - query: array
-   *  - url: string (used in lieu of "path"/"query")
+   *   - title: string
+   *   - path: string
+   *   - query: array
+   *   - url: string (used in lieu of "path"/"query")
    *      Note: if making "url" CRM_Utils_System::url(), set $htmlize=false
    * @return mixed
    */
@@ -1865,7 +1917,7 @@ abstract class CRM_Utils_Hook {
   }
 
   /**
-   * @param array<CRM_Core_FileSearchInterface> $fileSearches
+   * @param array <CRM_Core_FileSearchInterface> $fileSearches
    * @return mixed
    */
   public static function fileSearches(&$fileSearches) {
@@ -1874,4 +1926,5 @@ abstract class CRM_Utils_Hook {
       'civicrm_fileSearches'
     );
   }
+
 }