You are here

public static function PubSubHubbub::detectHubs in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/zendframework/zend-feed/src/PubSubHubbub/PubSubHubbub.php \Zend\Feed\PubSubHubbub\PubSubHubbub::detectHubs()

Simple utility function which imports any feed URL and determines the existence of Hub Server endpoints. This works best if directly given an instance of Zend\Feed\Reader\Atom|Rss to leverage off.

Parameters

\Zend\Feed\Reader\Feed\AbstractFeed|string $source:

Return value

array

Throws

Exception\InvalidArgumentException

File

vendor/zendframework/zend-feed/src/PubSubHubbub/PubSubHubbub.php, line 53

Class

PubSubHubbub

Namespace

Zend\Feed\PubSubHubbub

Code

public static function detectHubs($source) {
  if (is_string($source)) {
    $feed = Reader\Reader::import($source);
  }
  elseif ($source instanceof Reader\Feed\AbstractFeed) {
    $feed = $source;
  }
  else {
    throw new Exception\InvalidArgumentException('The source parameter was' . ' invalid, i.e. not a URL string or an instance of type' . ' Zend\\Feed\\Reader\\Feed\\AbstractFeed');
  }
  return $feed
    ->getHubs();
}