Fetch the list of notification
@param $length: count of the notification to be fetched
@param $status: the status of the notification
@param $offset: offset
@return notification list
511949
static function fetchNotificationList( $status = 1, $length = null, $offset = 0, $sorts = null )
    {
        $cond = array();
        if ( is_null( $status ) )
        {
            $cond = null;
        }
        else
        {
        $cond['status'] = $status;
        }
        $limit = array();
        if ( is_null( $length ) )
        {
            $limit = null;
        }
        else
        {
            $limit['offset'] = $offset;
            $limit['length'] = $length;
        }
        return eZPersistentObject::fetchObjectList( self::definition(), null, $cond, $sorts, $limit );
    }
662461
public function extractItems(int $offset, $length = null) : Collection {
      $items = array_slice($this->items, $offset, $length);
      return new Collection($items);
    }
757653
private function findFriendshipsByStatus($status, $limit, $offset): array
    {
        $friendships = [];

        $query = Friend::where(function ($query) use ($status) {
            $query->where('sender_id', $this->id);
            $query->where('sender_type', get_class($this));

            if (!empty($status)) {
                $query->where('status', $status);
            }
        })->orWhere(function ($query) use ($status) {
            $query->where('recipient_id', $this->id);
            $query->where('recipient_type', get_class($this));

            if (!empty($status)) {
                $query->where('status', $status);
            }
        });

        if (!empty($limit)) {
            $query->take($limit);
        }

        if (!empty($offset)) {
            $query->skip($offset);
        }

        foreach ($query->get() as $friendship) {
            $friendships[] = $this->getFriendship($this->find(
                ($friendship->sender_id == $this->id) ? $friendship->recipient_id : $friendship->sender_id
            ));
        }

        return $friendships;
    }
418292
public function substr(int $offset, int $length = -1, bool $remove = false) {
        if ($this->swoole_buffer) {
            return $this->swoole_buffer->substr($offset, $length, $remove);
        }
        return null;
    }
937120
public function getSlice($offset, $length)
    {
        return $this->datasetFactory
            ->bookmarks()
            ->load($offset, $length)
            ->getBookmarks();
    }
503463
public function paginateNews ($offset = 0, $count = 20)
    {
        $json = $this->paginate(MediaType::ARTICLE, $offset, $count);
        $resultSet = [];
        
        foreach ($json->item as $item) {
            $resultSet[] = $this->expandNews(
                $item->content->news_item,
                new Paginated\News($item->media_id, $item->update_time)
            );
        }

        return new Paginated\NewsResultSet($resultSet, $json->total_count, $offset);
    }
909389
public function getItemForPagination(
        string $status = '',
        string $text = '',
        string $url = '',
        string $rel = '',
        string $page = ''
    ): array {
        return [
            'status' => $status,
            'text'   => $text,
            'url'    => $url,
            'rel'    => $rel,
            'page'   => $page,
        ];
    }
1051428
private function getMessage($status) {
		if($this->messages === false) {
			$this->messages = require(__DIR__ . '/messages.php');
		}

		return isset($this->messages[$status]) ? $this->messages[$status] : "Error: $status";
	}
952993
public function path($offset = null, $length = null)
    {
        $ancestors = array_map(
            function ($ancestor) {
                return $ancestor->getName();
            },
            $this->ancestors()
        );

        $ancestors = array_slice(array_reverse($ancestors), $offset, $length);

        $res = implode(":", $ancestors);

        return $res;
    }
889047
public function lists($type, $offset = 0, $count = 20, $agentId)
    {
        $params = array(
                   'type' => $type,
                   'offset' => intval($offset),
                   'count' => min(20, $count),
                   'agentid' => $agentId,
                  );

        return $this->http->jsonPost(self::API_FOREVER_LIST, $params);
    }
953732
public function getReadBuffer(&$length): Promise
    {
        try {
            $result = $this->getReadBufferAsync($length);
        } catch (\Throwable $exception) {
            return new Failure($exception);
        }
        if ($result instanceof \Generator) {
            return new Coroutine($result);
        }
        if ($result instanceof Promise) {
            return $result;
        }

        return new Success($result);
    }
900366
protected function ApiStatus2InternalStatus($status)
    {
        switch ($status) {
            case Api::Success:
                return self::Status_Success;
            case Api::Errors:
                return self::Status_Errors;
            case Api::Warnings:
                return self::Status_Warnings;
            case Api::Exception:
            default:
                return self::Status_Exception;
        }
    }
123753
public function slice($offset = 0, $length = null)
    {
        return $this->createSubCrawler(\array_slice($this->nodes, $offset, $length));
    }
368179
public static function get($length = -1, int $offset = 0) : array
    {
        $ret     = [];
        $results = static::$_session->get("_RESULTS");

        if(
            !is_numeric($length)     &&
            isset($results[$length])
        ) {
            $ret = $results[$length]["result"];

            if($results[$length]["type"] === "flash") {
                unset($results[$length]);

                static::$_session->set("_RESULTS", $results);
            }

            return $ret;
        }

        foreach($results as $key => $value) {
            if($offset > 0) {
                $offset--;
                continue;
            }

            $ret[$key] = $$value["result"];

            if($value["type"] == "flash") {
                unset($results[$key]);
            }

            if($length-- == 0) {
                break;
            }
        }

        static::$_session->set("_RESULTS", $results);

        return $ret;
    }
6734
public function receiveMessage($length = null)
    {
        if (null === $length)
            return stream_get_contents($this->getSocketStream());
        $response = null;
        while ($chunk = fread($this->getSocketStream(), 1024)) {
            $response .= $chunk;
            if (substr($chunk, -1) === "\n") {
                break;
            }
        }
        return $response;
    }
1183738
public function readahead($length, $offset = null, $cb = null, $pri = EIO_PRI_DEFAULT)
    {
        $cb = CallbackWrapper::forceWrap($cb);
        if (!$this->fd) {
            if ($cb) {
                $cb($this, false);
            }
            return false;
        }
        if (!FileSystem::$supported) {
            if ($cb) {
                $cb($this, false);
            }
            return false;
        }
        $this->offset += $length;
        return eio_readahead(
            $this->fd,
            $length,
            $offset !== null ? $offset : $this->offset,
            $pri,
            $cb,
            $this
        );
    }
1364758
public function getSlice($offset, $length)
    {
        $query = clone $this->query;
        $query->offset = $offset;
        $query->limit = $length;
        $query->performCount = false;

        $searchResult = $this->filterService->filterLocations($query);

        // Set count for further use if returned by search engine despite !performCount (Solr, ES)
        if (!isset($this->nbResults) && isset($searchResult->totalCount)) {
            $this->nbResults = $searchResult->totalCount;
        }

        if (!isset($this->facets) && isset($searchResult->facets)) {
            $this->facets = $searchResult->facets;
        }

        $list = [];
        foreach ($searchResult->searchHits as $hit) {
            $list[] = $hit->valueObject;
        }

        return $list;
    }