trait SchemaCheckTrait (View source)

Provides a trait for checking configuration schema.

Properties

protected Element $schema

The config schema wrapper object for the configuration object under test.

protected string $configName

The configuration object name under test.

Methods

array|bool
checkConfigSchema(TypedConfigManagerInterface $typed_config, string $config_name, array $config_data)

Checks the TypedConfigManager has a valid schema for the configuration.

array
checkValue(string $key, mixed $value)

Helper method to check data type.

Details

array|bool checkConfigSchema(TypedConfigManagerInterface $typed_config, string $config_name, array $config_data)

Checks the TypedConfigManager has a valid schema for the configuration.

Parameters

TypedConfigManagerInterface $typed_config

The TypedConfigManager.

string $config_name

The configuration name.

array $config_data

The configuration data, assumed to be data for a top-level config object.

Return Value

array|bool

FALSE if no schema found. List of errors if any found. TRUE if fully valid.

protected array checkValue(string $key, mixed $value)

Helper method to check data type.

Parameters

string $key

A string of configuration key.

mixed $value

Value of given key.

Return Value

array

List of errors found while checking with the corresponding schema.