diff vendor/zendframework/zend-feed/src/Reader/Reader.php @ 12:7a779792577d

Update Drupal core to v8.4.5 (via Composer)
author Chris Cannam
date Fri, 23 Feb 2018 15:52:07 +0000
parents 4c8ae668cc8c
children c2387f117808
line wrap: on
line diff
--- a/vendor/zendframework/zend-feed/src/Reader/Reader.php	Fri Feb 23 15:51:18 2018 +0000
+++ b/vendor/zendframework/zend-feed/src/Reader/Reader.php	Fri Feb 23 15:52:07 2018 +0000
@@ -12,9 +12,9 @@
 use DOMDocument;
 use DOMXPath;
 use Zend\Cache\Storage\StorageInterface as CacheStorage;
+use Zend\Feed\Reader\Exception\InvalidHttpClientException;
 use Zend\Http as ZendHttp;
 use Zend\Stdlib\ErrorHandler;
-use Zend\Feed\Reader\Exception\InvalidHttpClientException;
 
 /**
 */
@@ -222,7 +222,9 @@
             }
             $response = $client->get($uri, $headers);
             if ($response->getStatusCode() !== 200 && $response->getStatusCode() !== 304) {
-                throw new Exception\RuntimeException('Feed failed to load, got response code ' . $response->getStatusCode());
+                throw new Exception\RuntimeException(
+                    'Feed failed to load, got response code ' . $response->getStatusCode()
+                );
             }
             if ($response->getStatusCode() == 304) {
                 $responseXml = $data;
@@ -247,7 +249,9 @@
             }
             $response = $client->get($uri);
             if ((int) $response->getStatusCode() !== 200) {
-                throw new Exception\RuntimeException('Feed failed to load, got response code ' . $response->getStatusCode());
+                throw new Exception\RuntimeException(
+                    'Feed failed to load, got response code ' . $response->getStatusCode()
+                );
             }
             $responseXml = $response->getBody();
             $cache->setItem($cacheId, $responseXml);
@@ -255,7 +259,9 @@
         } else {
             $response = $client->get($uri);
             if ((int) $response->getStatusCode() !== 200) {
-                throw new Exception\RuntimeException('Feed failed to load, got response code ' . $response->getStatusCode());
+                throw new Exception\RuntimeException(
+                    'Feed failed to load, got response code ' . $response->getStatusCode()
+                );
             }
             $reader = static::importString($response->getBody());
             $reader->setOriginalSourceUri($uri);
@@ -289,7 +295,9 @@
         }
 
         if ((int) $response->getStatusCode() !== 200) {
-            throw new Exception\RuntimeException('Feed failed to load, got response code ' . $response->getStatusCode());
+            throw new Exception\RuntimeException(
+                'Feed failed to load, got response code ' . $response->getStatusCode()
+            );
         }
         $reader = static::importString($response->getBody());
         $reader->setOriginalSourceUri($uri);
@@ -307,7 +315,7 @@
     public static function importString($string)
     {
         $trimmed = trim($string);
-        if (!is_string($string) || empty($trimmed)) {
+        if (! is_string($string) || empty($trimmed)) {
             throw new Exception\InvalidArgumentException('Only non empty strings are allowed as input');
         }
 
@@ -325,7 +333,7 @@
         libxml_disable_entity_loader($oldValue);
         libxml_use_internal_errors($libxmlErrflag);
 
-        if (!$status) {
+        if (! $status) {
             // Build error message
             $error = libxml_get_last_error();
             if ($error && $error->message) {
@@ -384,7 +392,9 @@
         $client   = static::getHttpClient();
         $response = $client->get($uri);
         if ($response->getStatusCode() !== 200) {
-            throw new Exception\RuntimeException("Failed to access $uri, got response code " . $response->getStatusCode());
+            throw new Exception\RuntimeException(
+                "Failed to access $uri, got response code " . $response->getStatusCode()
+            );
         }
         $responseHtml = $response->getBody();
         $libxmlErrflag = libxml_use_internal_errors(true);
@@ -393,7 +403,7 @@
         $status = $dom->loadHTML(trim($responseHtml));
         libxml_disable_entity_loader($oldValue);
         libxml_use_internal_errors($libxmlErrflag);
-        if (!$status) {
+        if (! $status) {
             // Build error message
             $error = libxml_get_last_error();
             if ($error && $error->message) {
@@ -425,8 +435,8 @@
             $dom = $feed->getDomDocument();
         } elseif ($feed instanceof DOMDocument) {
             $dom = $feed;
-        } elseif (is_string($feed) && !empty($feed)) {
-            ErrorHandler::start(E_NOTICE|E_WARNING);
+        } elseif (is_string($feed) && ! empty($feed)) {
+            ErrorHandler::start(E_NOTICE | E_WARNING);
             ini_set('track_errors', 1);
             $oldValue = libxml_disable_entity_loader(true);
             $dom = new DOMDocument;
@@ -441,8 +451,8 @@
             libxml_disable_entity_loader($oldValue);
             ini_restore('track_errors');
             ErrorHandler::stop();
-            if (!$status) {
-                if (!isset($phpErrormsg)) {
+            if (! $status) {
+                if (! isset($phpErrormsg)) {
                     if (function_exists('xdebug_is_enabled')) {
                         $phpErrormsg = '(error message not available, when XDebug is running)';
                     } else {
@@ -552,7 +562,7 @@
      */
     public static function getExtensionManager()
     {
-        if (!isset(static::$extensionManager)) {
+        if (! isset(static::$extensionManager)) {
             static::setExtensionManager(new StandaloneExtensionManager());
         }
         return static::$extensionManager;
@@ -576,7 +586,7 @@
             }
         }
 
-        if (!$manager->has($feedName) && !$manager->has($entryName)) {
+        if (! $manager->has($feedName) && ! $manager->has($entryName)) {
             throw new Exception\RuntimeException('Could not load extension: ' . $name
                 . ' using Plugin Loader. Check prefix paths are configured and extension exists.');
         }