You are here

public function Subscriber::setOptions in Zircon Profile 8.0

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

Process any injected configuration options

Parameters

array|Traversable $options:

Return value

Subscriber

Throws

Exception\InvalidArgumentException

1 call to Subscriber::setOptions()
Subscriber::__construct in vendor/zendframework/zend-feed/src/PubSubHubbub/Subscriber.php
Constructor; accepts an array or Traversable instance to preset options for the Subscriber without calling all supported setter methods in turn.

File

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

Class

Subscriber

Namespace

Zend\Feed\PubSubHubbub

Code

public function setOptions($options) {
  if ($options instanceof Traversable) {
    $options = ArrayUtils::iteratorToArray($options);
  }
  if (!is_array($options)) {
    throw new Exception\InvalidArgumentException('Array or Traversable object' . 'expected, got ' . gettype($options));
  }
  if (array_key_exists('hubUrls', $options)) {
    $this
      ->addHubUrls($options['hubUrls']);
  }
  if (array_key_exists('callbackUrl', $options)) {
    $this
      ->setCallbackUrl($options['callbackUrl']);
  }
  if (array_key_exists('topicUrl', $options)) {
    $this
      ->setTopicUrl($options['topicUrl']);
  }
  if (array_key_exists('storage', $options)) {
    $this
      ->setStorage($options['storage']);
  }
  if (array_key_exists('leaseSeconds', $options)) {
    $this
      ->setLeaseSeconds($options['leaseSeconds']);
  }
  if (array_key_exists('parameters', $options)) {
    $this
      ->setParameters($options['parameters']);
  }
  if (array_key_exists('authentications', $options)) {
    $this
      ->addAuthentications($options['authentications']);
  }
  if (array_key_exists('usePathParameter', $options)) {
    $this
      ->usePathParameter($options['usePathParameter']);
  }
  if (array_key_exists('preferredVerificationMode', $options)) {
    $this
      ->setPreferredVerificationMode($options['preferredVerificationMode']);
  }
  return $this;
}