From 6441228e79c0d52274d95e7403fa91057a20fc43 Mon Sep 17 00:00:00 2001
From: Demian Katz <demian.katz@villanova.edu>
Date: Thu, 23 Aug 2012 12:29:17 -0400
Subject: [PATCH] Fixed DOMDocument issues -- missing namespace declarations,
 inconsistent capitalization.

---
 module/VuFind/src/VuFind/ILS/Driver/DAIA.php             | 9 +++++----
 module/VuFind/src/VuFind/ILS/Driver/PICA.php             | 7 ++++---
 module/VuFind/src/VuFind/Resolver/Driver/Ezb.php         | 4 ++--
 .../VuFind/src/VuFind/Resolver/Driver/Threesixtylink.php | 4 ++--
 .../VuFind/src/VuFind/Theme/Root/Helper/AuthorNotes.php  | 6 +++---
 module/VuFind/src/VuFind/Theme/Root/Helper/Excerpt.php   | 6 +++---
 module/VuFind/src/VuFind/Theme/Root/Helper/Reviews.php   | 8 ++++----
 .../VuFind/src/VuFind/Theme/Root/Helper/VideoClips.php   | 6 +++---
 8 files changed, 26 insertions(+), 24 deletions(-)

diff --git a/module/VuFind/src/VuFind/ILS/Driver/DAIA.php b/module/VuFind/src/VuFind/ILS/Driver/DAIA.php
index dc8bfe1febd..5da06062855 100644
--- a/module/VuFind/src/VuFind/ILS/Driver/DAIA.php
+++ b/module/VuFind/src/VuFind/ILS/Driver/DAIA.php
@@ -28,7 +28,8 @@
  * @link     http://vufind.org/wiki/building_an_ils_driver Wiki
  */
 namespace VuFind\ILS\Driver;
-use VuFind\Config\Reader as ConfigReader, VuFind\Exception\ILS as ILSException;
+use DOMDocument, VuFind\Config\Reader as ConfigReader,
+    VuFind\Exception\ILS as ILSException;
 
 /**
  * ILS Driver for VuFind to query availability information via DAIA.
@@ -142,18 +143,18 @@ class DAIA implements DriverInterface
     }
 
     /**
-     * Query a DAIA server and return the result as DomDocument object.
+     * Query a DAIA server and return the result as DOMDocument object.
      * The returned object is an XML document containing
      * content as described in the DAIA format specification.
      *
      * @param string $id Document to look up.
      *
-     * @return DomDocument Object representation of an XML document containing
+     * @return DOMDocument Object representation of an XML document containing
      * content as described in the DAIA format specification.
      */
     protected function queryDAIA($id)
     {
-        $daia = new DomDocument();
+        $daia = new DOMDocument();
         $daia->load($this->baseURL . '?output=xml&ppn='.$id);
 
         return $daia;
diff --git a/module/VuFind/src/VuFind/ILS/Driver/PICA.php b/module/VuFind/src/VuFind/ILS/Driver/PICA.php
index bd15d3a9c49..4be10b4dcaa 100644
--- a/module/VuFind/src/VuFind/ILS/Driver/PICA.php
+++ b/module/VuFind/src/VuFind/ILS/Driver/PICA.php
@@ -30,7 +30,8 @@
  * @link     http://vufind.org/wiki/building_an_ils_driver Wiki
  */
 namespace VuFind\ILS\Driver;
-use VuFind\Config\Reader as ConfigReader, VuFind\Exception\ILS as ILSException;
+use DOMDocument, VuFind\Config\Reader as ConfigReader,
+    VuFind\Exception\ILS as ILSException;
 
 /**
  * ILS Driver for VuFind to get information from PICA
@@ -671,7 +672,7 @@ class PICA extends DAIA
         $searchUrl = "http://" . $this->catalogHost .
             "/DB={$this->dbsid}/XML=1.0/CMD?ACT=SRCHA&IKT=1016&SRT=YOP&TRM=sgn+" .
             $barcode;
-        $doc = new DomDocument();
+        $doc = new DOMDocument();
         $doc->load($searchUrl);
         // get Availability information from DAIA
         $itemlist = $doc->getElementsByTagName('SHORTTITLE');
@@ -695,7 +696,7 @@ class PICA extends DAIA
         $searchUrl = "http://" . $this->catalogHost .
             "/DB={$this->dbsid}/XML=1.0/SET=1/TTL=1/FAM?PPN=" . $ppn .
             "&SHRTST=10000";
-        $doc = new DomDocument();
+        $doc = new DOMDocument();
         $doc->load($searchUrl);
         $itemlist = $doc->getElementsByTagName('SHORTTITLE');
         $ppn = array();
diff --git a/module/VuFind/src/VuFind/Resolver/Driver/Ezb.php b/module/VuFind/src/VuFind/Resolver/Driver/Ezb.php
index 631c8f491c8..702e9ecea1e 100644
--- a/module/VuFind/src/VuFind/Resolver/Driver/Ezb.php
+++ b/module/VuFind/src/VuFind/Resolver/Driver/Ezb.php
@@ -31,7 +31,7 @@
  * @link     http://vufind.org/wiki/building_a_link_resolver_driver Wiki
  */
 namespace VuFind\Resolver\Driver;
-use DomDocument, DOMXpath, VuFind\Config\Reader as ConfigReader;
+use DOMDocument, DOMXpath, VuFind\Config\Reader as ConfigReader;
 
 /**
  * EZB Link Resolver Driver
@@ -112,7 +112,7 @@ class Ezb implements DriverInterface
     {
         $records = array(); // array to return
 
-        $xml = new DomDocument();
+        $xml = new DOMDocument();
         if (!@$xml->loadXML($xmlstr)) {
             return $records;
         }
diff --git a/module/VuFind/src/VuFind/Resolver/Driver/Threesixtylink.php b/module/VuFind/src/VuFind/Resolver/Driver/Threesixtylink.php
index 4c4d6b276c6..33e9bef1a5a 100644
--- a/module/VuFind/src/VuFind/Resolver/Driver/Threesixtylink.php
+++ b/module/VuFind/src/VuFind/Resolver/Driver/Threesixtylink.php
@@ -28,7 +28,7 @@
  * @link     http://vufind.org/wiki/building_a_link_resolver_driver Wiki
  */
 namespace VuFind\Resolver\Driver;
-use DomDocument, DOMXpath, VuFind\Config\Reader as ConfigReader;
+use DOMDocument, DOMXpath, VuFind\Config\Reader as ConfigReader;
 
 /**
  * 360Link Link Resolver Driver
@@ -86,7 +86,7 @@ class Threesixtylink implements DriverInterface
     {
         $records = array(); // array to return
 
-        $xml = new DomDocument();
+        $xml = new DOMDocument();
         if (!@$xml->loadXML($xmlstr)) {
             return $records;
         }
diff --git a/module/VuFind/src/VuFind/Theme/Root/Helper/AuthorNotes.php b/module/VuFind/src/VuFind/Theme/Root/Helper/AuthorNotes.php
index 213edb82de9..09b73cfe7e6 100644
--- a/module/VuFind/src/VuFind/Theme/Root/Helper/AuthorNotes.php
+++ b/module/VuFind/src/VuFind/Theme/Root/Helper/AuthorNotes.php
@@ -26,7 +26,7 @@
  * @link     http://vufind.org/wiki/building_a_recommendations_module Wiki
  */
 namespace VuFind\Theme\Root\Helper;
-use VuFind\Config\Reader as ConfigReader, VuFind\Code\ISBN,
+use DOMDocument, VuFind\Config\Reader as ConfigReader, VuFind\Code\ISBN,
     VuFind\Http\Client as HttpClient, Zend\View\Helper\AbstractHelper;
 
 /**
@@ -147,7 +147,7 @@ class AuthorNotes extends AbstractHelper
         }
 
         // Test XML Response
-        if (!($xmldoc = @DOMDocument::loadXML($result->getBody()))) {
+        if (!($xmldoc = DOMDocument::loadXML($result->getBody()))) {
             throw new \Exception('Invalid XML');
         }
 
@@ -166,7 +166,7 @@ class AuthorNotes extends AbstractHelper
                 }
 
                 // Test XML Response
-                $xmldoc2 = @DOMDocument::loadXML($result2->getBody());
+                $xmldoc2 = DOMDocument::loadXML($result2->getBody());
                 if (!$xmldoc2) {
                     throw new \Exception('Invalid XML');
                 }
diff --git a/module/VuFind/src/VuFind/Theme/Root/Helper/Excerpt.php b/module/VuFind/src/VuFind/Theme/Root/Helper/Excerpt.php
index 79396c82a81..6afbbf9a0ca 100644
--- a/module/VuFind/src/VuFind/Theme/Root/Helper/Excerpt.php
+++ b/module/VuFind/src/VuFind/Theme/Root/Helper/Excerpt.php
@@ -26,7 +26,7 @@
  * @link     http://vufind.org/wiki/building_a_recommendations_module Wiki
  */
 namespace VuFind\Theme\Root\Helper;
-use VuFind\Config\Reader as ConfigReader, VuFind\Code\ISBN,
+use DOMDocument, VuFind\Config\Reader as ConfigReader, VuFind\Code\ISBN,
     VuFind\Http\Client as HttpClient, Zend\View\Helper\AbstractHelper;
 
 /**
@@ -148,7 +148,7 @@ class Excerpt extends AbstractHelper
         }
 
         // Test XML Response
-        if (!($xmldoc = @DOMDocument::loadXML($result->getBody()))) {
+        if (!($xmldoc = DOMDocument::loadXML($result->getBody()))) {
             throw new \Exception('Invalid XML');
         }
 
@@ -167,7 +167,7 @@ class Excerpt extends AbstractHelper
                 }
 
                 // Test XML Response
-                $xmldoc2 = @DOMDocument::loadXML($result2->getBody());
+                $xmldoc2 = DOMDocument::loadXML($result2->getBody());
                 if (!$xmldoc2) {
                     throw new \Exception('Invalid XML');
                 }
diff --git a/module/VuFind/src/VuFind/Theme/Root/Helper/Reviews.php b/module/VuFind/src/VuFind/Theme/Root/Helper/Reviews.php
index 8ad179f02ec..80a92aeee02 100644
--- a/module/VuFind/src/VuFind/Theme/Root/Helper/Reviews.php
+++ b/module/VuFind/src/VuFind/Theme/Root/Helper/Reviews.php
@@ -26,7 +26,7 @@
  * @link     http://vufind.org/wiki/building_a_recommendations_module Wiki
  */
 namespace VuFind\Theme\Root\Helper;
-use VuFind\Config\Reader as ConfigReader, VuFind\Code\ISBN,
+use DOMDocument, VuFind\Config\Reader as ConfigReader, VuFind\Code\ISBN,
     VuFind\Http\Client as HttpClient, Zend\View\Helper\AbstractHelper,
     ZendService\Amazon\Amazon;
 
@@ -157,7 +157,7 @@ class Reviews extends AbstractHelper
         $result = $client->setMethod('GET')->send();
 
         $data = !$result->isSuccess()
-            ? false : @simplexml_load_string($result->getBody());
+            ? false : simplexml_load_string($result->getBody());
         if (!$data) {
             return array();
         }
@@ -323,7 +323,7 @@ class Reviews extends AbstractHelper
         }
 
         // Test XML Response
-        if (!($xmldoc = @DOMDocument::loadXML($result->getBody()))) {
+        if (!($xmldoc = DOMDocument::loadXML($result->getBody()))) {
             throw new \Exception('Invalid XML');
         }
 
@@ -341,7 +341,7 @@ class Reviews extends AbstractHelper
                 }
 
                 // Test XML Response
-                $xmldoc2 = @DOMDocument::loadXML($result2->getBody());
+                $xmldoc2 = DOMDocument::loadXML($result2->getBody());
                 if (!$xmldoc2) {
                     throw new \Exception('Invalid XML');
                 }
diff --git a/module/VuFind/src/VuFind/Theme/Root/Helper/VideoClips.php b/module/VuFind/src/VuFind/Theme/Root/Helper/VideoClips.php
index b934beb8528..6076d45bfa0 100644
--- a/module/VuFind/src/VuFind/Theme/Root/Helper/VideoClips.php
+++ b/module/VuFind/src/VuFind/Theme/Root/Helper/VideoClips.php
@@ -26,7 +26,7 @@
  * @link     http://vufind.org/wiki/building_a_recommendations_module Wiki
  */
 namespace VuFind\Theme\Root\Helper;
-use VuFind\Config\Reader as ConfigReader, VuFind\Code\ISBN,
+use DOMDocument, VuFind\Config\Reader as ConfigReader, VuFind\Code\ISBN,
     VuFind\Http\Client as HttpClient, Zend\View\Helper\AbstractHelper;
 
 /**
@@ -147,7 +147,7 @@ class VideoClips extends AbstractHelper
         }
 
         // Test XML Response
-        if (!($xmldoc = @DOMDocument::loadXML($result->getBody()))) {
+        if (!($xmldoc = DOMDocument::loadXML($result->getBody()))) {
             throw new \Exception('Invalid XML');
         }
 
@@ -166,7 +166,7 @@ class VideoClips extends AbstractHelper
                 }
 
                 // Test XML Response
-                $xmldoc2 = @DOMDocument::loadXML($result2->getBody());
+                $xmldoc2 = DOMDocument::loadXML($result2->getBody());
                 if (!$xmldoc2) {
                     throw new \Exception('Invalid XML');
                 }
-- 
GitLab