/** * Process $skip and $top options * * @return void * * @throws ODataException Throws syntax error if the $skip or $top option * is specified with non-integer value, throws * bad request error if the $skip or $top option * is not applicable for the requested resource. */ private function _processSkipAndTop() { $value = null; if ($this->_readSkipOrTopOption(ODataConstants::HTTPQUERY_STRING_SKIP, $value)) { $this->_requestDescription->setSkipCount($value); } $pageSize = 0; $isPagingRequired = $this->_isSSPagingRequired(); if ($isPagingRequired) { $pageSize = $this->_requestDescription->getTargetResourceSetWrapper()->getResourceSetPageSize(); } if ($this->_readSkipOrTopOption(ODataConstants::HTTPQUERY_STRING_TOP, $value)) { $this->_requestDescription->setTopOptionCount($value); if ($isPagingRequired && $pageSize < $value) { //If $top is greater than or equal to page size, //we will need a $skiptoken and thus our response //will be 2.0 $this->_requestDescription->raiseResponseVersion(2, 0, $this->_dataService); $this->_requestDescription->setTopCount($pageSize); } else { $this->_requestDescription->setTopCount($value); } } else { if ($isPagingRequired) { $this->_requestDescription->raiseResponseVersion(2, 0, $this->_dataService); $this->_requestDescription->setTopCount($pageSize); } } if (!is_null($this->_requestDescription->getSkipCount()) || !is_null($this->_requestDescription->getTopCount())) { $this->_checkSetQueryApplicable(); } }