You are here

class PaginationParameterFactory in JSON-RPC 8

Same name and namespace in other branches
  1. 2.x src/ParameterFactory/PaginationParameterFactory.php \Drupal\jsonrpc\ParameterFactory\PaginationParameterFactory

A parameter factory to handle paginated responses.

Hierarchy

Expanded class hierarchy of PaginationParameterFactory

File

src/ParameterFactory/PaginationParameterFactory.php, line 11

Namespace

Drupal\jsonrpc\ParameterFactory
View source
class PaginationParameterFactory extends ParameterFactoryBase {

  /**
   * {@inheritdoc}
   */
  public static function schema(ParameterDefinitionInterface $parameter_definition) {
    return [
      'type' => 'object',
      'properties' => [
        'limit' => [
          'type' => 'integer',
          'minimum' => 0,
        ],
        'offset' => [
          'type' => 'integer',
          'minimum' => 0,
        ],
      ],
    ];
  }

  /**
   * {@inheritdoc}
   */
  public function getOutputValidator() {

    // The input is the same as the output.
    return $this
      ->getInputValidator();
  }

  /**
   * {@inheritdoc}
   */
  protected function doTransform($data, Context $context = NULL) {
    return $data;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
PaginationParameterFactory::doTransform protected function
PaginationParameterFactory::getOutputValidator public function
PaginationParameterFactory::schema public static function An array representing the JSON Schema for acceptable input to the factory. Overrides ParameterFactoryInterface::schema
ParameterFactoryBase::$definition protected property The parameter definition.
ParameterFactoryBase::$inputValidator protected property The validation class for shaper interactions.
ParameterFactoryBase::$validator protected property The schema validator to ensure the input data adheres to the expectation.
ParameterFactoryBase::create public static function Instantiates a new instance of this class. Overrides ParameterFactoryInterface::create 1
ParameterFactoryBase::getInputValidator public function
ParameterFactoryBase::__construct public function ParameterFactoryBase constructor. 1