示例#1
0
 /**
  * Read skip or top query option value which is expected to be positive 
  * integer. 
  * 
  * @param string $queryItem The name of the query item to read from request
  *                          uri ($skip or $top).
  * @param int    &$value    On return, If the requested query item is 
  *                          present with a valid integer value then this
  *                          argument will holds that integer value 
  *                          otherwise holds zero.
  * 
  * @return boolean True     If the requested query item with valid integer 
  *                          value is present in the request, false query 
  *                          item is absent in the request uri. 
  * 
  * @throws ODataException   Throws syntax error if the requested argument 
  *                          is present and it is not an integer.
  */
 private function _readSkipOrTopOption($queryItem, &$value)
 {
     $value = $this->_dataService->getHost()->getQueryStringItem($queryItem);
     if (!is_null($value)) {
         $int = new Int32();
         if (!$int->validate($value, $outValue)) {
             ODataException::createSyntaxError(Messages::queryProcessorIncorrectArgumentFormat($queryItem, $value));
         }
         $value = intval($value);
         if ($value < 0) {
             ODataException::createSyntaxError(Messages::queryProcessorIncorrectArgumentFormat($queryItem, $value));
         }
         return true;
     }
     $value = 0;
     return false;
 }