ResourceValidator
in package
Class ResourceValidator
Validate a resource definition.
Table of Contents
- $helper : ProcessorHelper
- $accountMapper : AccountMapper
- $applicationMapper : ApplicationMapper
- $db : ADOConnection|null
- $logger : MonologWrapper
- $meta : array<string|int, mixed>
- $settings : Config
- __construct() : mixed
- Constructor. Store processor metadata and request data in object.
- validate() : void
- Validate a complete resource metadata is well-formed.
- getProcessorClass() : mixed
- Fetch the class for a processor.
- validateCardinality() : void
- Validate the cardinality of an input.
- validateCoreProtection() : void
- Validate application is not core and core not locked.
- validateExtraInputs() : void
- Validate that no extra inputs in a node.
- validateIdenticalIds() : void
- Search for identical IDs.
- validateLimitProcessors() : void
- Validate the processors in an input.
- validateLimitTypes() : void
- Validate the literal input types in an input.
- validateLimitValues() : void
- Validate the literal values in an input.
- validateLiteralAllowed() : void
- Validate the cardinality of an input.
- validateMissingInputs() : void
- Validate that no required inputs are missing in a node.
- validateNode() : void
- Validate the attributes on a node in the metadata.
- validateNonMetaValues() : void
- Validate non-meta security/fragment/process/output values 9in the resource.
- validateRequiredResourceAttributes() : void
- Validate the required resource attributes exist in the metadata.
- validateSection() : void
- Validate the details of a metadata section (security, fragment, process or output).
Properties
$helper
protected
ProcessorHelper
$helper
Processor helper class.
$accountMapper
private
AccountMapper
$accountMapper
Account mapper class.
$applicationMapper
private
ApplicationMapper
$applicationMapper
Application mapper class.
$db
private
ADOConnection|null
$db
DB connection class.
$logger
private
MonologWrapper
$logger
Logging class.
$meta
private
array<string|int, mixed>
$meta
Resource metadata.
$settings
private
Config
$settings
Config class.
Methods
__construct()
Constructor. Store processor metadata and request data in object.
public
__construct(ADOConnection $db, MonologWrapper $logger) : mixed
Parameters
- $db : ADOConnection
-
Database.
- $logger : MonologWrapper
-
Logger.
Return values
mixed —validate()
Validate a complete resource metadata is well-formed.
public
validate(array<string|int, mixed> $meta) : void
An exception is thrown if the resource is invalid.
Parameters
- $meta : array<string|int, mixed>
-
Resource metadata.
Tags
Return values
void —getProcessorClass()
Fetch the class for a processor.
protected
getProcessorClass(array<string|int, mixed> $node) : mixed
Parameters
- $node : array<string|int, mixed>
Tags
Return values
mixed —validateCardinality()
Validate the cardinality of an input.
protected
validateCardinality(string $inputKey, array<string|int, mixed> $cardinality, array<string|int, mixed> $node) : void
Parameters
- $inputKey : string
-
Input key.
- $cardinality : array<string|int, mixed>
-
Processor input cardinality.
- $node : array<string|int, mixed>
-
processor metadata.
Tags
Return values
void —validateCoreProtection()
Validate application is not core and core not locked.
protected
validateCoreProtection() : void
Tags
Return values
void —validateExtraInputs()
Validate that no extra inputs in a node.
protected
validateExtraInputs(array<string|int, mixed> $node, array<string|int, mixed> $inputs) : void
Parameters
- $node : array<string|int, mixed>
- $inputs : array<string|int, mixed>
Tags
Return values
void —validateIdenticalIds()
Search for identical IDs.
protected
validateIdenticalIds() : void
Tags
Return values
void —validateLimitProcessors()
Validate the processors in an input.
protected
validateLimitProcessors(string $inputKey, array<string|int, mixed> $limitProcessors, array<string|int, mixed> $node) : void
Parameters
- $inputKey : string
-
Input key.
- $limitProcessors : array<string|int, mixed>
-
Limit processors allowed in an input.
- $node : array<string|int, mixed>
-
processor metadata.
Tags
Return values
void —validateLimitTypes()
Validate the literal input types in an input.
protected
validateLimitTypes(string $inputKey, array<string|int, mixed> $limitTypes, array<string|int, mixed> $node) : void
Parameters
- $inputKey : string
-
Input key.
- $limitTypes : array<string|int, mixed>
-
Limit var types allowed in an input.
- $node : array<string|int, mixed>
-
processor metadata.
Tags
Return values
void —validateLimitValues()
Validate the literal values in an input.
protected
validateLimitValues(string $inputKey, array<string|int, mixed> $limitValues, array<string|int, mixed> $node) : void
Parameters
- $inputKey : string
-
Input key.
- $limitValues : array<string|int, mixed>
-
Limit values allowed in an input.
- $node : array<string|int, mixed>
-
processor metadata.
Tags
Return values
void —validateLiteralAllowed()
Validate the cardinality of an input.
protected
validateLiteralAllowed(string $inputKey, bool $literalAllowed, array<string|int, mixed> $node) : void
Parameters
- $inputKey : string
-
Input key.
- $literalAllowed : bool
-
Literal allowed for an input.
- $node : array<string|int, mixed>
-
processor metadata.
Tags
Return values
void —validateMissingInputs()
Validate that no required inputs are missing in a node.
protected
validateMissingInputs(array<string|int, mixed> $node, array<string|int, mixed> $inputs) : void
Parameters
- $node : array<string|int, mixed>
- $inputs : array<string|int, mixed>
Tags
Return values
void —validateNode()
Validate the attributes on a node in the metadata.
protected
validateNode(array<string|int, mixed> $node, array<string|int, mixed> $details) : void
Parameters
- $node : array<string|int, mixed>
- $details : array<string|int, mixed>
Tags
Return values
void —validateNonMetaValues()
Validate non-meta security/fragment/process/output values 9in the resource.
protected
validateNonMetaValues() : void
Tags
Return values
void —validateRequiredResourceAttributes()
Validate the required resource attributes exist in the metadata.
protected
validateRequiredResourceAttributes() : void
Tags
Return values
void —validateSection()
Validate the details of a metadata section (security, fragment, process or output).
private
validateSection(array<string|int, mixed> $stack, bool $allowFragments) : void
Parameters
- $stack : array<string|int, mixed>
-
Stack of nodes to parse.
- $allowFragments : bool
-
Allow fragments in the processor.