getPaginationParameters() публичный Метод

Pagination parameters are not detailed in the specification however a keyword 'page' is reserved for pagination. This method returns key and value pairs from input 'page' parameter.
public getPaginationParameters ( ) : array | null
Результат array | null
Пример #1
0
 /**
  * @param ErrorCollection             $errors
  * @param EncodingParametersInterface $parameters
  */
 protected function checkPaging(ErrorCollection $errors, EncodingParametersInterface $parameters)
 {
     $withinAllowed = $this->keysWithinAllowed($parameters->getPaginationParameters(), $this->pagingParameters);
     $withinAllowed === true ?: $errors->addQueryParameterError(QP::PARAM_PAGE, T::t('Page parameter should contain only allowed values.'));
 }
Пример #2
0
 /**
  * @param ErrorCollection             $errors
  * @param EncodingParametersInterface $parameters
  *
  * @return array
  */
 public function mapParameters(ErrorCollection $errors, EncodingParametersInterface $parameters)
 {
     $filters = $this->mapFilterParameters($errors, $parameters->getFilteringParameters());
     $sorts = $this->mapSortParameters($errors, $parameters->getSortParameters());
     $includes = $this->mapIncludeParameters($errors, $parameters->getIncludePaths());
     $paging = $parameters->getPaginationParameters();
     return [$filters, $sorts, $includes, $paging];
 }
 /**
  * @param string                           $key
  * @param mixed                            $default
  * @param EncodingParametersInterface|null $parameters
  *
  * @return mixed
  */
 protected function getPagingParameter($key, $default, EncodingParametersInterface $parameters = null)
 {
     $value = $default;
     if ($parameters !== null) {
         $paging = $parameters->getPaginationParameters();
         if (empty($paging) === false && array_key_exists($key, $paging) === true) {
             $tmp = (int) $paging[$key];
             $value = $tmp < 0 || $tmp > static::MAX_PAGE_SIZE ? static::MAX_PAGE_SIZE : $tmp;
         }
     }
     return $value;
 }