Merge pull request #6160 from eileenmcnaughton/CRM-16737
[civicrm-core.git] / CRM / Queue / ErrorPolicy.php
index 817e112069aec1f95d00c31ebf8698699dfacba3..9a3a97b0964cc6589ca6b5538570168337e869d7 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.                                    |
  |                                                                    |
@@ -23,7 +23,7 @@
  | GNU Affero General Public License or the licensing of CiviCRM,     |
  | see the CiviCRM license FAQ at http://civicrm.org/licensing        |
  +--------------------------------------------------------------------+
-*/
+ */
 
 /**
  * To ensure that PHP errors or unhandled exceptions are reported in JSON
@@ -63,7 +63,10 @@ class CRM_Queue_ErrorPolicy {
     $this->active = TRUE;
     $this->backup = array();
     foreach (array(
-      'display_errors', 'html_errors', 'xmlrpc_errors') as $key) {
+               'display_errors',
+               'html_errors',
+               'xmlrpc_errors',
+             ) as $key) {
       $this->backup[$key] = ini_get($key);
       ini_set($key, 0);
     }
@@ -79,7 +82,10 @@ class CRM_Queue_ErrorPolicy {
     $this->errorScope = NULL;
     restore_error_handler();
     foreach (array(
-      'display_errors', 'html_errors', 'xmlrpc_errors') as $key) {
+               'display_errors',
+               'html_errors',
+               'xmlrpc_errors',
+             ) as $key) {
       ini_set($key, $this->backup[$key]);
     }
     $this->active = FALSE;
@@ -99,7 +105,7 @@ class CRM_Queue_ErrorPolicy {
     try {
       $result = $callable();
     }
-    catch(Exception$e) {
+    catch (Exception$e) {
       $this->reportException($e);
     }
     $this->deactivate();
@@ -135,7 +141,7 @@ class CRM_Queue_ErrorPolicy {
   }
 
   /**
-   * Print a fatal error
+   * Print a fatal error.
    *
    * @param array $error
    *   The PHP error (with "type", "message", etc).
@@ -156,7 +162,7 @@ class CRM_Queue_ErrorPolicy {
   }
 
   /**
-   * Print an unhandled exception
+   * Print an unhandled exception.
    *
    * @param Exception $e
    *   The unhandled exception.
@@ -183,4 +189,5 @@ class CRM_Queue_ErrorPolicy {
     }
     CRM_Utils_JSON::output($response);
   }
+
 }