Skip to content

Commit

Permalink
Merge pull request #1 from mwinandy/UseFixs
Browse files Browse the repository at this point in the history
Path fix for Exception (prevent conflicts with symfony)
  • Loading branch information
rquadling committed Sep 6, 2015
2 parents 847d484 + bceaa7e commit a1a7f8f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions src/Array2XML.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
namespace LaLit;

use DOMDocument;
use \DOMDocument;

/**
* Array2XML: A class to convert array in PHP to XML
Expand Down Expand Up @@ -110,7 +110,7 @@ private static function convert($node_name, $arr = array())
if (isset($arr['@attributes'])) {
foreach ($arr['@attributes'] as $key => $value) {
if (!self::isValidTagName($key)) {
throw new Exception('[Array2XML] Illegal character in attribute name. attribute: ' . $key . ' in node: ' . $node_name);
throw new \Exception('[Array2XML] Illegal character in attribute name. attribute: ' . $key . ' in node: ' . $node_name);
}
$node->setAttribute($key, self::bool2str($value));
}
Expand All @@ -137,7 +137,7 @@ private static function convert($node_name, $arr = array())
// recurse to get the node for that key
foreach ($arr as $key => $value) {
if (!self::isValidTagName($key)) {
throw new Exception('[Array2XML] Illegal character in tag name. tag: ' . $key . ' in node: ' . $node_name);
throw new \Exception('[Array2XML] Illegal character in tag name. tag: ' . $key . ' in node: ' . $node_name);
}
if (is_array($value) && is_numeric(key($value))) {
// MORE THAN ONE NODE OF ITS KIND;
Expand Down
8 changes: 4 additions & 4 deletions src/XML2Array.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php
namespace LaLit;

use DOMDocument;
use Exception;
use \DOMDocument;
use \Exception;

/**
* XML2Array: A class to convert XML to array in PHP
Expand Down Expand Up @@ -52,11 +52,11 @@ public static function createArray($input_xml)
if (is_string($input_xml)) {
$parsed = $xml->loadXML($input_xml);
if (!$parsed) {
throw new Exception('[XML2Array] Error parsing the XML string.');
throw new \Exception('[XML2Array] Error parsing the XML string.');
}
} else {
if (get_class($input_xml) != 'DOMDocument') {
throw new Exception('[XML2Array] The input XML object should be of type: DOMDocument.');
throw new \Exception('[XML2Array] The input XML object should be of type: DOMDocument.');
}
$xml = self::$xml = $input_xml;
}
Expand Down

0 comments on commit a1a7f8f

Please sign in to comment.