EmbeddedUser
extends User
in package
Uses
MarshalTrait
Table of Contents
- $age : int
- $contacts : array<string|int, mixed>
- $email : string|null
- $firstName : string
- $height : float
- $lastName : string
- $options : Options|null
- $cachedHolders : array<string|int, mixed>
- A list of {@link PropertyHolder} instances used to fetch properties, field attributes, etc.
- $reflectedInstance : ReflectionClass
- A ReflectionClass instance used to fetch properties, values, etc.
- __construct() : mixed
- loadFromJson() : static
- This method is used to load JSON data from a file and unmarshal it into an instance of the trait user
- loadFromYaml() : static
- This method is used to load YAML data from a file and unmarshal it into an instance of the trait user
- marshal() : array<string|int, mixed>
- saveToJson() : int|false
- This method is used to marshal the object and save it into a JSON file
- saveToYaml() : bool
- This method is used to marshal the object and save it into a YAML file
- unmarshal() : MarshalTrait
- checkType() : void
- This method is used as a way to check if a property's types are compatible with the value being set
- getField() : Field|null
- Attempts to get the Field attribute from a property If the property doesn't have the Field attribute, it will return null
- getHolders() : array<int, PropertyHolder>
- A lazy getter/initializer for getting the {@link PropertyHolder} instances for the implementing class.
- getReflectedInstance() : ReflectionClass
- getTypeNames() : array<string|int, mixed>
- This method is used to compile a list of names associated with a given type
- hasEdgeCase() : bool
- This method is used as a way to check for weird edge cases that can occur between types.
Properties
$age
public
int
$age
$contacts
public
array<string|int, mixed>
$contacts
= []
public
string|null
$email
= null
$firstName
public
string
$firstName
$height
public
float
$height
$lastName
public
string
$lastName
$options
public
Options|null
$options
= null
$cachedHolders
A list of {@link PropertyHolder} instances used to fetch properties, field attributes, etc.
private
static array<string|int, mixed>
$cachedHolders
$reflectedInstance
A ReflectionClass instance used to fetch properties, values, etc.
private
static ReflectionClass
$reflectedInstance
Methods
__construct()
public
__construct(string $firstName, string $lastName, int $age, float $height, array<string|int, string> $contacts, string $email[, Options|null $options = null ]) : mixed
Parameters
- $firstName : string
- $lastName : string
- $age : int
- $height : float
- $contacts : array<string|int, string>
- $email : string
- $options : Options|null = null
Return values
mixed —loadFromJson()
This method is used to load JSON data from a file and unmarshal it into an instance of the trait user
public
static loadFromJson(string $fileName[, bool $strict = true ][, int $depth = 512 ][, int $flags = 0 ]) : static
Parameters
- $fileName : string
- $strict : bool = true
- $depth : int = 512
- $flags : int = 0
Tags
Return values
static —loadFromYaml()
This method is used to load YAML data from a file and unmarshal it into an instance of the trait user
public
static loadFromYaml(string $fileName[, bool $strict = true ][, int $pos = 0 ][, int|null &$ndocs = null ][, array<string|int, mixed> $callbacks = [] ]) : static
Parameters
- $fileName : string
- $strict : bool = true
- $pos : int = 0
- $ndocs : int|null = null
- $callbacks : array<string|int, mixed> = []
Tags
Return values
static —marshal()
public
marshal() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —saveToJson()
This method is used to marshal the object and save it into a JSON file
public
saveToJson(string $fileName[, int $flags = 0 ][, int $depth = 512 ]) : int|false
Parameters
- $fileName : string
- $flags : int = 0
- $depth : int = 512
Tags
Return values
int|false —saveToYaml()
This method is used to marshal the object and save it into a YAML file
public
saveToYaml(string $fileName[, int $encoding = YAML_ANY_ENCODING ][, int $linebreak = YAML_ANY_BREAK ][, array<string|int, mixed> $callbacks = [] ]) : bool
Parameters
- $fileName : string
- $encoding : int = YAML_ANY_ENCODING
- $linebreak : int = YAML_ANY_BREAK
- $callbacks : array<string|int, mixed> = []
Tags
Return values
bool —unmarshal()
public
static unmarshal(array<string|int, mixed> $data[, bool $strict = true ]) : MarshalTrait
Parameters
- $data : array<string|int, mixed>
-
- The data to unmarshal with
- $strict : bool = true
-
- Whether to throw an exception if a field is missing
Tags
Return values
MarshalTrait —checkType()
This method is used as a way to check if a property's types are compatible with the value being set
private
static checkType(ReflectionProperty $property, mixed $value) : void
Parameters
- $property : ReflectionProperty
- $value : mixed
Tags
Return values
void —getField()
Attempts to get the Field attribute from a property If the property doesn't have the Field attribute, it will return null
private
static getField(ReflectionProperty $property) : Field|null
Parameters
- $property : ReflectionProperty
Return values
Field|null —getHolders()
A lazy getter/initializer for getting the {@link PropertyHolder} instances for the implementing class.
private
static getHolders() : array<int, PropertyHolder>
Return values
array<int, PropertyHolder> —getReflectedInstance()
private
static getReflectedInstance() : ReflectionClass
Return values
ReflectionClass —getTypeNames()
This method is used to compile a list of names associated with a given type
private
static getTypeNames(ReflectionType $type) : array<string|int, mixed>
Parameters
- $type : ReflectionType
Return values
array<string|int, mixed> —hasEdgeCase()
This method is used as a way to check for weird edge cases that can occur between types.
private
static hasEdgeCase(ReflectionType $type, mixed $value) : bool
Parameters
- $type : ReflectionType
- $value : mixed