DefaultConfigMapper extends BasePropertyBuilderConfigMapper
A factory for creating instances of Builders and Properties based on IPropertyType.
Maintains 2 maps:
1) A map of IPropertyType => IPropertyBuilder factory for creating property builder instances based on type 2) A map of IPropertyType => IProperty factory for creating instances of IProperty using the appropriate builder defined in step 1
Tags
Table of Contents
$ioc | IOC container | IIOC |
---|---|---|
$dateFormat | Date format to use when converting Date properties to strings. | string |
$pbIoc | PropertyBuilder instance factory | IPropertyBuilderIoC |
$pIoc | Property factory | IPropertyIoC |
$propertyTypes | A map of string => IPropertyType | array |
$getPropertyFlags | Retrieve a new propertyFlags instance | Closure |
__construct() | Create a new PropertyFactory using some configuration array | mixed |
createModelIOCClosure() | Closure|null | |
getMoneyFactory() | IMoneyFactory | |
__construct() | Create a new PropertyFactory using some configuration array | mixed |
map() | Take a config array and convert it to a list of IProperty instances. | array |
createPropertyBehavior() | Create a new PropertyBehavior instance. | IPropertyBehavior |
createPropertyFlags() | IPropertyFlags | |
setCustomProperty() | Sets the builder property value based on the array key. | mixed |
createProperty() | IProperty | |
createBuilder() | IPropertyBuilder | |
setProperty() | Sets the builder property value based on the array key | mixed |
Properties
$ioc
IOC container
private
IIOC
$ioc
$dateFormat
Date format to use when converting Date properties to strings.
private
string
$dateFormat
$pbIoc
PropertyBuilder instance factory
private
IPropertyBuilderIoC
$pbIoc
$pIoc
Property factory
private
IPropertyIoC
$pIoc
$propertyTypes
A map of string => IPropertyType
private
array
$propertyTypes
$getPropertyFlags
Retrieve a new propertyFlags instance
private
Closure
$getPropertyFlags
Methods
__construct()
Create a new PropertyFactory using some configuration array
public
__construct(
[ $ioc :
IIOC|null
= null ]
[, $dateFormat :
string
= 'Y-m-d H:i:s' ]
)
: mixed
Parameters
- $ioc : IIOC|null = null
DANGER: Passing the IOC container is not inherently safe, but it is required to create IModel instances.
- $dateFormat : string = 'Y-m-d H:i:s'
Date format to use when converting Date properties to strings.
Return values
mixedcreateModelIOCClosure()
private
createModelIOCClosure(
)
: Closure|null
Return values
Closure|nullgetMoneyFactory()
private
getMoneyFactory(
)
: IMoneyFactory
Return values
IMoneyFactory__construct()
Create a new PropertyFactory using some configuration array
public
__construct(
$pbIoc :
IPropertyBuilderIoC
, $pIoc :
IPropertyIoC
[, $getPropertyFlags :
Closure|null
= null ]
)
: mixed
Parameters
- $pbIoc : IPropertyBuilderIoC
- $pIoc : IPropertyIoC
- $getPropertyFlags : Closure|null = null
f() : IPropertyFlags - Retrieve a new property flags instance for use
Return values
mixedmap()
Take a config array and convert it to a list of IProperty instances.
public
map(
$config :
array
)
: array
If anything is wrong, exceptions get thrown.
Parameters
- $config : array
Tags
Return values
array —IProperty[] list of properties defined in $config
createPropertyBehavior()
Create a new PropertyBehavior instance.
protected
createPropertyBehavior(
[ $validate :
Closure|null
= null ]
[, $init :
Closure|null
= null ]
[, $setter :
Closure|null
= null ]
[, $getter :
Closure|null
= null ]
[, $msetter :
Closure|null
= null ]
[, $mgetter :
Closure|null
= null ]
[, $onChange :
Closure|null
= null ]
[, $isEmpty :
Closure|null
= null ]
[, $htmlInput :
Closure|null
= null ]
)
: IPropertyBehavior
Parameters
- $validate : Closure|null = null
Validate closure f( IProperty, $value ) Throw a ValidationException on error
- $init : Closure|null = null
- $setter : Closure|null = null
- $getter : Closure|null = null
- $msetter : Closure|null = null
- $mgetter : Closure|null = null
- $onChange : Closure|null = null
- $isEmpty : Closure|null = null
- $htmlInput : Closure|null = null
Return values
IPropertyBehaviorcreatePropertyFlags()
protected
createPropertyFlags(
$values :
mixed
)
: IPropertyFlags
Parameters
- $values : mixed
Return values
IPropertyFlagssetCustomProperty()
Sets the builder property value based on the array key.
protected
setCustomProperty(
$b :
PropertyBuilder
, $name :
string
, $k :
string
, $v :
string
)
: mixed
This function intentionally does nothing. Override this to handle some custom property type.
Parameters
- $b : PropertyBuilder
Builder instance
- $name : string
Property Name
- $k : string
Property Attribute Name
- $v : string
Property Attribute Value
Tags
Return values
mixedcreateProperty()
private
createProperty(
$builder :
IPropertyBuilder
)
: IProperty
Parameters
- $builder : IPropertyBuilder
Return values
IPropertycreateBuilder()
private
createBuilder(
$name :
string
, $data :
array
)
: IPropertyBuilder
Parameters
- $name : string
- $data : array
Return values
IPropertyBuildersetProperty()
Sets the builder property value based on the array key
private
setProperty(
$b :
PropertyBuilder
, $name :
string
, $k :
string
, $v :
string
)
: mixed
Parameters
- $b : PropertyBuilder
Builder instance
- $name : string
Property Name
- $k : string
Property Attribute Name
- $v : string
Property Attribute Value