Tdt\Core\Pager::getLinkHeader PHP Method

getLinkHeader() protected static method

Provide paging headers in the response using the Link HTTP header.
protected static getLinkHeader ( $paging )
    protected static function getLinkHeader($paging)
    {
        $link_value = '';
        foreach ($paging as $keyword => $page_info) {
            if (!in_array($keyword, array_keys(self::$PAGING_KEYWORDS))) {
                $key_words = implode(', ', array_keys(self::$PAGING_KEYWORDS));
                \App::abort(400, "The given paging keyword, {$keyword}, has not been found. Supported keywords are {$key_words}.");
            } elseif (count($page_info) != 2) {
                \App::abort(400, "The provided page info did not contain 2 parts, it should only contain a page number and a page size.");
            }
            $request_string = self::buildQuerystring();
            $link_value .= \Request::url() . '?offset=' . $page_info[0] . '&limit=' . $page_info[1] . $request_string . ';rel=' . self::$PAGING_KEYWORDS[$keyword] . ',';
        }
        // Trim the most right comma off.
        return rtrim($link_value, ",");
    }