Property | Type | Description | |
---|---|---|---|
$schema | The actual schema to maps the data. |
Property | Type | Description | |
---|---|---|---|
$castableTypes | string[] | Types that can be casted. |
Method | Description | |
---|---|---|
__construct ( |
||
map ( array | object $data ) : array | Maps the input $data to the schema specified in the $schema property. | |
parseField ( mixed $value, string $fieldType ) : mixed | Parse a value based on a field yype of the schema. |
Method | Description | |
---|---|---|
cast ( mixed $value, string $type ) : mixed | Uses PHP's settype to cast a value to a type. | |
clearDynamic ( array &$data ) : void | If the schema is not dynamic, remove all non specified fields. | |
mapToSchema ( mixed $value, string $schemaClass ) : mixed | Instantiate another SchemaMapper with the given $schemaClass and maps the given $value. | |
parseToArray ( mixed $object ) : array | Parses an object to an array before sending it to the SchemaMapper. |
public __construct ( |
||
$schema | Schema that will be used to map each field. |
protected clearDynamic ( array &$data ) : void | ||
$data | array | Reference of the fields. The passed array will be modified. |
return | void |
protected parseToArray ( mixed $object ) : array | ||
$object | mixed | The object that will be transformed into an array. |
return | array |
protected string[] $castableTypes | ||
return | string[] |