コード例 #1
0
 /**
  * @return bool
  */
 private function expiredLifeTime()
 {
     if (!$this->stream->useCache()) {
         return true;
     }
     $time = get_transient(self::_lifeTimeName($this->stream->getId()));
     if (false === $time) {
         return true;
     }
     return time() > $time;
 }
コード例 #2
0
 private function prepareResult($all, $errors)
 {
     $result = array();
     $allCount = sizeof($all);
     if ($allCount > 0) {
         $count = (int) $this->settings->getCountOfPosts();
         $count = $count > $allCount ? $allCount : $count;
         usort($all, array($this, 'compareByTime'));
         $result = array_slice($all, 0, $count);
     }
     $response = array('id' => (int) $this->settings->getId(), 'items' => $result, 'errors' => $errors);
     return json_encode($response);
 }