You are here

public function Feed::getUpdateFrequencyAsTicks in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/zendframework/zend-feed/src/Reader/Extension/Syndication/Feed.php \Zend\Feed\Reader\Extension\Syndication\Feed::getUpdateFrequencyAsTicks()

Get update frequency as ticks

Return value

int

File

vendor/zendframework/zend-feed/src/Reader/Extension/Syndication/Feed.php, line 70

Class

Feed

Namespace

Zend\Feed\Reader\Extension\Syndication

Code

public function getUpdateFrequencyAsTicks() {
  $name = 'updateFrequency';
  $freq = $this
    ->getData($name, 'number');
  if (!$freq || $freq < 1) {
    $this->data[$name] = 1;
    $freq = 1;
  }
  $period = $this
    ->getUpdatePeriod();
  $ticks = 1;
  switch ($period) {
    case 'yearly':
      $ticks *= 52;

    //TODO: fix generalisation, how?

    // no break
    case 'weekly':
      $ticks *= 7;

    // no break
    case 'daily':
      $ticks *= 24;

    // no break
    case 'hourly':
      $ticks *= 3600;
      break;
    default:

      //Never arrive here, exception thrown in getPeriod()
      break;
  }
  return $ticks / $freq;
}