You are here

public function Publisher::notifyAll in Zircon Profile 8.0

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

Notifies all Hub Server URLs of changes

If a Hub notification fails, certain data will be retained in an an array retrieved using getErrors(), if a failure occurs for any Hubs the isSuccess() check will return FALSE. This method is designed not to needlessly fail with an Exception/Error unless from Zend\Http\Client.

Return value

void

Throws

Exception\RuntimeException

File

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

Class

Publisher

Namespace

Zend\Feed\PubSubHubbub

Code

public function notifyAll() {
  $client = $this
    ->_getHttpClient();
  $hubs = $this
    ->getHubUrls();
  if (empty($hubs)) {
    throw new Exception\RuntimeException('No Hub Server URLs' . ' have been set so no notifications can be sent');
  }
  $this->errors = [];
  foreach ($hubs as $url) {
    $client
      ->setUri($url);
    $response = $client
      ->getResponse();
    if ($response
      ->getStatusCode() !== 204) {
      $this->errors[] = [
        'response' => $response,
        'hubUrl' => $url,
      ];
    }
  }
}