Merge remote-tracking branch 'upstream/4.5' into 4.5-master-2015-02-09-11-44-07
[civicrm-core.git] / CRM / Utils / XML.php
index 420efb3bb0c4878bbacb2e45d191a4f887a9e659..1128b75669da12da0634d7e31c776235671a0676 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.5                                                |
+ | CiviCRM version 4.6                                                |
  +--------------------------------------------------------------------+
  | Copyright CiviCRM LLC (c) 2004-2014                                |
  +--------------------------------------------------------------------+
  | GNU Affero General Public License or the licensing of CiviCRM,     |
  | see the CiviCRM license FAQ at http://civicrm.org/licensing        |
  +--------------------------------------------------------------------+
-*/
+ */
 
 /**
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2014
  * $Id$
  */
-
 class CRM_Utils_XML {
 
   /**
@@ -38,15 +37,17 @@ class CRM_Utils_XML {
    *
    * @param $file
    *
-   * @return array (0 => SimpleXMLElement|FALSE, 1 => errorMessage|FALSE)
+   * @return array
+   *   (0 => SimpleXMLElement|FALSE, 1 => errorMessage|FALSE)
    */
   public static function parseFile($file) {
     $xml = FALSE; // SimpleXMLElement
     $error = FALSE; // string
 
-    if (! file_exists($file)) {
+    if (!file_exists($file)) {
       $error = 'File ' . $file . ' does not exist.';
-    } else {
+    }
+    else {
       $oldLibXMLErrors = libxml_use_internal_errors();
       libxml_use_internal_errors(TRUE);
 
@@ -68,7 +69,8 @@ class CRM_Utils_XML {
    *
    * @param $string
    *
-   * @return array (0 => SimpleXMLElement|FALSE, 1 => errorMessage|FALSE)
+   * @return array
+   *   (0 => SimpleXMLElement|FALSE, 1 => errorMessage|FALSE)
    */
   public static function parseString($string) {
     $xml = FALSE; // SimpleXMLElement
@@ -104,7 +106,7 @@ class CRM_Utils_XML {
 
       $parts = array();
       if ($error->file) {
-          $parts[] = "File=$error->file";
+        $parts[] = "File=$error->file";
       }
       $parts[] = "Line=$error->line";
       $parts[] = "Column=$error->column";
@@ -117,9 +119,10 @@ class CRM_Utils_XML {
   }
 
   /**
-   * Convert an XML element to an array
+   * Convert an XML element to an array.
    *
-   * @param $obj SimpleXMLElement
+   * @param $obj
+   *   SimpleXMLElement.
    *
    * @return array
    */
@@ -143,4 +146,5 @@ class CRM_Utils_XML {
     }
     return $arr;
   }
+
 }