Mercurial > hg > cmmr2012-drupal-site
comparison vendor/zendframework/zend-feed/src/Reader/Reader.php @ 4:a9cd425dd02b
Update, including to Drupal core 8.6.10
author | Chris Cannam |
---|---|
date | Thu, 28 Feb 2019 13:11:55 +0000 |
parents | 5311817fb629 |
children |
comparison
equal
deleted
inserted
replaced
3:307d7a7fd348 | 4:a9cd425dd02b |
---|---|
278 * Primary purpose is to make it possible to use the Reader with alternate | 278 * Primary purpose is to make it possible to use the Reader with alternate |
279 * HTTP client implementations. | 279 * HTTP client implementations. |
280 * | 280 * |
281 * @param string $uri | 281 * @param string $uri |
282 * @param Http\ClientInterface $client | 282 * @param Http\ClientInterface $client |
283 * @return self | 283 * @return Feed\FeedInterface |
284 * @throws Exception\RuntimeException if response is not an Http\ResponseInterface | 284 * @throws Exception\RuntimeException if response is not an Http\ResponseInterface |
285 */ | 285 */ |
286 public static function importRemoteFeed($uri, Http\ClientInterface $client) | 286 public static function importRemoteFeed($uri, Http\ClientInterface $client) |
287 { | 287 { |
288 $response = $client->get($uri); | 288 $response = $client->get($uri); |
347 | 347 |
348 $type = static::detectType($dom); | 348 $type = static::detectType($dom); |
349 | 349 |
350 static::registerCoreExtensions(); | 350 static::registerCoreExtensions(); |
351 | 351 |
352 if (substr($type, 0, 3) == 'rss') { | 352 if (0 === strpos($type, 'rss')) { |
353 $reader = new Feed\Rss($dom, $type); | 353 $reader = new Feed\Rss($dom, $type); |
354 } elseif (substr($type, 8, 5) == 'entry') { | 354 } elseif (8 === strpos($type, 'entry')) { |
355 $reader = new Entry\Atom($dom->documentElement, 0, self::TYPE_ATOM_10); | 355 $reader = new Entry\Atom($dom->documentElement, 0, self::TYPE_ATOM_10); |
356 } elseif (substr($type, 0, 4) == 'atom') { | 356 } elseif (0 === strpos($type, 'atom')) { |
357 $reader = new Feed\Atom($dom, $type); | 357 $reader = new Feed\Atom($dom, $type); |
358 } else { | 358 } else { |
359 throw new Exception\RuntimeException('The URI used does not point to a ' | 359 throw new Exception\RuntimeException('The URI used does not point to a ' |
360 . 'valid Atom, RSS or RDF feed that Zend\Feed\Reader can parse.'); | 360 . 'valid Atom, RSS or RDF feed that Zend\Feed\Reader can parse.'); |
361 } | 361 } |