protected function requestPageNumber($pageNumber, $forceRefresh = false)
    {
        if (!isset($this->data[$this->pageNumberToKey($pageNumber)]) || ($forceRefresh && isset($this->api))) {
            // assume one page if no pagination (and already loaded)
            if (isset($this->pagination[CanvasPageLink::CURRENT])) {
                $params = $this->pagination[CanvasPageLink::CURRENT]->getParams();
                $params[CanvasPageLink::PARAM_PAGE_NUMBER] = $pageNumber;
                $page = $this->api->get($this->pagination[CanvasPageLink::CURRENT]->getEndpoint(), $params);
                $this->data = array_replace($this->data, $page->data);
                $pagination = $this->parsePageLinks();
                $this->paginationPerPage[$pagination[CanvasPageLink::CURRENT]->getPageNumber()] = $pagination;
                return true;
            }
        }
        return false;
    }
protected function requestPageNumber($pageNumber, $forceRefresh = false)
    {
        if (!isset($this->data[$this->pageNumberToKey($pageNumber)]) || ($forceRefresh && isset($this->api))) {
            // assume one page if no pagination (and already loaded)
            if (isset($this->pagination[CanvasPageLink::CURRENT])) {
                $params = $this->pagination[CanvasPageLink::CURRENT]->getParams();
                $params[CanvasPageLink::PARAM_PAGE_NUMBER] = $pageNumber;
                $page = $this->api->get($this->pagination[CanvasPageLink::CURRENT]->getEndpoint(), $params);
                $this->data = array_replace($this->data, $page->data);
                $pagination = $this->parsePageLinks();
                $this->paginationPerPage[$pagination[CanvasPageLink::CURRENT]->getPageNumber()] = $pagination;
                return true;
            }
        }
        return false;
    }
protected function requestPageNumber ( $ pageNumber , $ forceRefresh = false ) { if ( ! isset ( $ this -> data [ $ this -> pageNumberToKey ( $ pageNumber ) ] ) || ( $ forceRefresh && isset ( $ this -> api ) ) ) { // assume one page if no pagination (and already loaded) if ( isset ( $ this -> pagination [ CanvasPageLink :: CURRENT ] ) ) { $ params = $ this -> pagination [ CanvasPageLink :: CURRENT ] -> getParams ( ) ; $ params [ CanvasPageLink :: PARAM_PAGE_NUMBER ] = $ pageNumber ; $ page = $ this -> api -> get ( $ this -> pagination [ CanvasPageLink :: CURRENT ] -> getEndpoint ( ) , $ params ) ; $ this -> data = array_replace ( $ this -> data , $ page -> data ) ; $ pagination = $ this -> parsePageLinks ( ) ; $ this -> paginationPerPage [ $ pagination [ CanvasPageLink :: CURRENT ] -> getPageNumber ( ) ] = $ pagination ; return true ; } } return false ; }
Request a page of responses from the API

A page of responses will be requested if it appears that that page has
not yet been loaded (tested by checking if the initial element of the
page has been initialized in the $data array).

@param int $pageNumber Page number to request
@param bool $forceRefresh (Optional) Force a refresh of backing data,
even if cached (defaults to `FALSE`)

@return bool `TRUE` if the page is requested, `FALSE` if it is already
cached (and therefore not requested)
Request a page of responses from the API