You are here

public function Publisher::notifyHub in Zircon Profile 8

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

Notifies a single Hub Server URL of changes

Parameters

string $url The Hub Server's URL:

Return value

void

Throws

Exception\InvalidArgumentException

Exception\RuntimeException

File

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

Class

Publisher

Namespace

Zend\Feed\PubSubHubbub

Code

public function notifyHub($url) {
  if (empty($url) || !is_string($url) || !Uri::factory($url)
    ->isValid()) {
    throw new Exception\InvalidArgumentException('Invalid parameter "url"' . ' of "' . $url . '" must be a non-empty string and a valid' . 'URL');
  }
  $client = $this
    ->_getHttpClient();
  $client
    ->setUri($url);
  $response = $client
    ->getResponse();
  if ($response
    ->getStatusCode() !== 204) {
    throw new Exception\RuntimeException('Notification to Hub Server ' . 'at "' . $url . '" appears to have failed with a status code of "' . $response
      ->getStatusCode() . '" and message "' . $response
      ->getContent() . '"');
  }
}