Utility/DomainEntityBuilder.phpView Source

Show: PublicProtectedPrivateinherited
Table of Contents
Package
Default  

\Intuit\Ipp\Utility\DomainEntityBuilder

Package: Default
Converts stdClass object into domain object
Author
amatiushkin  

Properties

>VPropertyprivatearray $definedValues = null
List of values which new entity must have
Default valuenullDetails
Type
array
>VPropertyprivate\Intuit\Ipp\Utility\type $model = null
Array of AbstractEntity instances, which contains complete meta data
Default valuenullDetails
Type
\Intuit\Ipp\Utility\type
>VPropertyprivatestring $originalClassName = null
Contains original class name or type of converted object
Default valuenullDetails
Type
string
>VPropertyprivate\Intuit\Ipp\Utility\type $properties = null
Array of ReflectionProperties instances for the specified class
Default valuenullDetails
Type
\Intuit\Ipp\Utility\type
>VPropertyprivate\ReflectionClass $reflection = null
Reflection of class
Default valuenullDetails
Type
\ReflectionClass

Methods

methodpublic__construct(\Intuit\Ipp\Utility\strign $name) : void

Requires type or class of target instance

Parameters
NameTypeDescription
$name\Intuit\Ipp\Utility\strign
methodpubliccreate(string $type, array $values) : mixed
static

Creates instance of specified type and returns it as result.

Parameters
NameTypeDescription
$typestring
$valuesarray
Returns
TypeDescription
mixed
methodpubliccreateInstance() : mixed

Creates new instance with values

Returns
TypeDescription
mixedreturns domain model instance
methodprivateforgeInstance( $instance) : mixed

Creates new instance of target class with specified values It also adjusts any nested type based on suplied metadata (@var annotation)

Parameters
NameTypeDescription
$instance
Returns
TypeDescription
mixedreturns domain model instance
methodprivategetEntityFromModel(\Intuit\Ipp\Utility\type $index, \Intuit\Ipp\Utility\type $propertyName) : \Intuit\Ipp\Utility\AbstractEntity

Returns metadata description of property from model

Parameters
NameTypeDescription
$index\Intuit\Ipp\Utility\type
$propertyName\Intuit\Ipp\Utility\type
Returns
TypeDescription
\Intuit\Ipp\Utility\AbstractEntity
Throws
ExceptionDescription
\RuntimeException
methodpublicgetOriginalClassName() : \Intuit\Ipp\Utility\type

Returns target class name or type of new instance

Returns
TypeDescription
\Intuit\Ipp\Utility\type
methodprivategetReflection() : \ReflectionClass

Returns reflection object for target class

Returns
TypeDescription
\ReflectionClass
methodprivategetRootInstance() : void

methodprivateisMorhing(\Intuit\Ipp\Utility\AbstractEntity $entity, \Intuit\Ipp\Utility\stdClass $value) : boolean

Returns true if value can be converted into domain model instance

Parameters
NameTypeDescription
$entity\Intuit\Ipp\Utility\AbstractEntity
$value\Intuit\Ipp\Utility\stdClass
Returns
TypeDescription
boolean
methodprivatemakeReflection() : void

Create reflection based on class name

Throws
ExceptionDescription
\InvalidArgumentException
methodprivatepopulateProperties() : void

Collects properties of specified class

methodprivatepopulatePropertyComments() : mixed

Collect comments for defined properties. It will be used to extract meta data

Returns
TypeDescription
mixed
Throws
ExceptionDescription
\UnexpectedValueException
methodprivateprocessPropertyValue(mixed $instance, \ReflectionProperty $property, \Intuit\Ipp\Utility\AbstractEntity $model, \Intuit\Ipp\Utility\stdClass $value) : void

Converts value into domain model object

Parameters
NameTypeDescription
$instancemixed
  • contains empty of almost ready domain model entity
$property\ReflectionProperty
$model\Intuit\Ipp\Utility\AbstractEntity
$value\Intuit\Ipp\Utility\stdClass
methodprivateprocessPropertyValues(mixed $instance, \ReflectionProperty $property, \Intuit\Ipp\Utility\AbstractEntity $model,  $values) : void

Converts object values into domain model entities.

This function is array-compatible version of @see processPropertyValue
Parameters
NameTypeDescription
$instancemixed
  • contains empty of almost ready domain model entity
$property\ReflectionProperty
$model\Intuit\Ipp\Utility\AbstractEntity
$values
methodpublicusePropertyValues(array $values) : void

Adds properties and their values, which will be copied into new instance

Parameters
NameTypeDescription
$valuesarray
Documentation was generated by phpDocumentor 2.8.5.