abstract class ParameterFactoryBase in JSON-RPC 8
Same name and namespace in other branches
- 2.x src/ParameterFactory/ParameterFactoryBase.php \Drupal\jsonrpc\ParameterFactory\ParameterFactoryBase
Base class for parameter factories.
Hierarchy
- class \Drupal\jsonrpc\ParameterFactory\ParameterFactoryBase extends \Shaper\Transformation\TransformationBase implements ParameterFactoryInterface
Expanded class hierarchy of ParameterFactoryBase
File
- src/
ParameterFactory/ ParameterFactoryBase.php, line 16
Namespace
Drupal\jsonrpc\ParameterFactoryView source
abstract class ParameterFactoryBase extends TransformationBase implements ParameterFactoryInterface {
/**
* The schema validator to ensure the input data adheres to the expectation.
*
* @var \JsonSchema\Validator
*/
protected $validator;
/**
* The validation class for shaper interactions.
*
* @var \Shaper\Validator\ValidateableInterface
*/
protected $inputValidator;
/**
* The parameter definition.
*
* @var \Drupal\jsonrpc\ParameterDefinitionInterface
*/
protected $definition;
/**
* ParameterFactoryBase constructor.
*
* @param \Drupal\jsonrpc\ParameterDefinitionInterface $definition
* The parameter definition.
* @param \JsonSchema\Validator $validator
* The JSON Schema validation object.
*/
public function __construct(ParameterDefinitionInterface $definition, Validator $validator) {
$this->validator = $validator;
$this->definition = $definition;
}
/**
* {@inheritdoc}
*/
public static function create(ParameterDefinitionInterface $definition, ContainerInterface $container) {
return new static($definition, $container
->get('jsonrpc.schema_validator'));
}
/**
* {@inheritdoc}
*/
public function getInputValidator() {
if (!$this->inputValidator) {
$schema = $this->definition
->getSchema();
$this->inputValidator = new JsonSchemaValidator($schema, $this->validator, Constraint::CHECK_MODE_TYPE_CAST);
}
return $this->inputValidator;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ParameterFactoryBase:: |
protected | property | The parameter definition. | |
ParameterFactoryBase:: |
protected | property | The validation class for shaper interactions. | |
ParameterFactoryBase:: |
protected | property | The schema validator to ensure the input data adheres to the expectation. | |
ParameterFactoryBase:: |
public static | function |
Instantiates a new instance of this class. Overrides ParameterFactoryInterface:: |
1 |
ParameterFactoryBase:: |
public | function | ||
ParameterFactoryBase:: |
public | function | ParameterFactoryBase constructor. | 1 |
ParameterFactoryInterface:: |
public static | function | An array representing the JSON Schema for acceptable input to the factory. | 3 |