프로퍼티 | 타입 | 설명 | |
---|---|---|---|
$schema | The actual schema to maps the data. |
프로퍼티 | 타입 | 설명 | |
---|---|---|---|
$castableTypes | string[] | Types that can be casted. |
메소드 | 설명 | |
---|---|---|
__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. |
메소드 | 설명 | |
---|---|---|
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. |
리턴 | void |
protected parseToArray ( mixed $object ) : array | ||
$object | mixed | The object that will be transformed into an array. |
리턴 | array |