Blueprint
extends BlueprintForm
in package
Class Blueprint
Table of Contents
Properties
- $blueprintSchema : BlueprintSchema|null
- $context : string
- $defaults : array<string|int, mixed>|null
- $handlers : array<string|int, mixed>
- $object : object|null
- $scope : string|null
Methods
- __clone() : mixed
- Clone blueprint.
- addDynamicHandler() : void
- addPropertyRecursive() : void
- embed() : $this
- extend() : $this
- Extend blueprint with another blueprint.
- extra() : array<string|int, mixed>
- Return data fields that do not exist in blueprints.
- filter() : array<string|int, mixed>
- Filter data by using blueprints.
- flattenData() : array<string|int, mixed>
- Flatten data by using blueprints.
- getDefaults() : array<string|int, mixed>
- Get nested structure containing default values defined in the blueprints.
- getDefaultValue() : array<string|int, mixed>|mixed|null
- init() : $this
- Initialize blueprints with its dynamic fields.
- mergeData() : array<string|int, mixed>
- Merge two arrays by using blueprints.
- processForm() : array<string|int, mixed>
- Process data coming from a form.
- schema() : BlueprintSchema
- Return blueprint data schema.
- setObject() : void
- setScope() : void
- setTypes() : $this
- Set default values for field types.
- validate() : void
- Validate data against blueprints.
- dynamicConfig() : void
- dynamicData() : void
- dynamicScope() : void
- dynamicSecurity() : void
- getFiles() : array<string|int, mixed>
- initInternals() : void
- Initialize validator.
- loadFile() : array<string|int, mixed>
- resolveActions() : bool
Properties
$blueprintSchema
protected
BlueprintSchema|null
$blueprintSchema
$context
protected
string
$context
= 'blueprints://'
$defaults
protected
array<string|int, mixed>|null
$defaults
$handlers
protected
array<string|int, mixed>
$handlers
= []
$object
protected
object|null
$object
$scope
protected
string|null
$scope
Methods
__clone()
Clone blueprint.
public
__clone() : mixed
addDynamicHandler()
public
addDynamicHandler(string $name, callable $callable) : void
Parameters
- $name : string
- $callable : callable
addPropertyRecursive()
public
static addPropertyRecursive(array<string|int, mixed> &$field, string $property, mixed $value) : void
Parameters
- $field : array<string|int, mixed>
- $property : string
- $value : mixed
embed()
public
embed(string $name, mixed $value[, string $separator = '/' ][, bool $append = false ]) : $this
Parameters
- $name : string
- $value : mixed
- $separator : string = '/'
- $append : bool = false
Return values
$thisextend()
Extend blueprint with another blueprint.
public
extend(BlueprintForm|array<string|int, mixed> $extends[, bool $append = false ]) : $this
Parameters
- $extends : BlueprintForm|array<string|int, mixed>
- $append : bool = false
Return values
$thisextra()
Return data fields that do not exist in blueprints.
public
extra(array<string|int, mixed> $data[, string $prefix = '' ]) : array<string|int, mixed>
Parameters
- $data : array<string|int, mixed>
- $prefix : string = ''
Return values
array<string|int, mixed>filter()
Filter data by using blueprints.
public
filter(array<string|int, mixed> $data[, bool $missingValuesAsNull = false ][, bool $keepEmptyValues = false ]) : array<string|int, mixed>
Parameters
- $data : array<string|int, mixed>
- $missingValuesAsNull : bool = false
- $keepEmptyValues : bool = false
Return values
array<string|int, mixed>flattenData()
Flatten data by using blueprints.
public
flattenData(array<string|int, mixed> $data[, bool $includeAll = false ][, string $name = '' ]) : array<string|int, mixed>
Parameters
- $data : array<string|int, mixed>
-
Data to be flattened.
- $includeAll : bool = false
-
True if undefined properties should also be included.
- $name : string = ''
-
Property which will be flattened, useful for flattening repeating data.
Return values
array<string|int, mixed>getDefaults()
Get nested structure containing default values defined in the blueprints.
public
getDefaults() : array<string|int, mixed>
Fields without default value are ignored in the list.
Return values
array<string|int, mixed>getDefaultValue()
public
getDefaultValue(string $name) : array<string|int, mixed>|mixed|null
Parameters
- $name : string
Tags
Return values
array<string|int, mixed>|mixed|nullinit()
Initialize blueprints with its dynamic fields.
public
init() : $this
Return values
$thismergeData()
Merge two arrays by using blueprints.
public
mergeData(array<string|int, mixed> $data1, array<string|int, mixed> $data2[, string|null $name = null ][, string $separator = '.' ]) : array<string|int, mixed>
Parameters
- $data1 : array<string|int, mixed>
- $data2 : array<string|int, mixed>
- $name : string|null = null
-
Optional
- $separator : string = '.'
-
Optional
Return values
array<string|int, mixed>processForm()
Process data coming from a form.
public
processForm(array<string|int, mixed> $data[, array<string|int, mixed> $toggles = [] ]) : array<string|int, mixed>
Parameters
- $data : array<string|int, mixed>
- $toggles : array<string|int, mixed> = []
Return values
array<string|int, mixed>schema()
Return blueprint data schema.
public
schema() : BlueprintSchema
Return values
BlueprintSchemasetObject()
public
setObject(object $object) : void
Parameters
- $object : object
setScope()
public
setScope(string $scope) : void
Parameters
- $scope : string
setTypes()
Set default values for field types.
public
setTypes(array<string|int, mixed> $types) : $this
Parameters
- $types : array<string|int, mixed>
Return values
$thisvalidate()
Validate data against blueprints.
public
validate(array<string|int, mixed> $data[, array<string|int, mixed> $options = [] ]) : void
Parameters
- $data : array<string|int, mixed>
- $options : array<string|int, mixed> = []
Tags
dynamicConfig()
protected
dynamicConfig(array<string|int, mixed> &$field, string $property, array<string|int, mixed> &$call) : void
Parameters
- $field : array<string|int, mixed>
- $property : string
- $call : array<string|int, mixed>
dynamicData()
protected
dynamicData(array<string|int, mixed> &$field, string $property, array<string|int, mixed> &$call) : void
Parameters
- $field : array<string|int, mixed>
- $property : string
- $call : array<string|int, mixed>
dynamicScope()
protected
dynamicScope(array<string|int, mixed> &$field, string $property, array<string|int, mixed> &$call) : void
Parameters
- $field : array<string|int, mixed>
- $property : string
- $call : array<string|int, mixed>
dynamicSecurity()
protected
dynamicSecurity(array<string|int, mixed> &$field, string $property, array<string|int, mixed> &$call) : void
Parameters
- $field : array<string|int, mixed>
- $property : string
- $call : array<string|int, mixed>
getFiles()
protected
getFiles(string|array<string|int, mixed> $path[, string|null $context = null ]) : array<string|int, mixed>
Parameters
- $path : string|array<string|int, mixed>
- $context : string|null = null
Return values
array<string|int, mixed>initInternals()
Initialize validator.
protected
initInternals() : void
loadFile()
protected
loadFile(string $filename) : array<string|int, mixed>
Parameters
- $filename : string
Return values
array<string|int, mixed>resolveActions()
protected
resolveActions(UserInterface|null $user, array<string|int, mixed> $actions[, string $op = 'and' ]) : bool
Parameters
- $user : UserInterface|null
- $actions : array<string|int, mixed>
- $op : string = 'and'