/** * @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; }
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); }