Menu

## ObjectCreationCompiler
in package

ObjectCreationCompiler.php : 20

Compiles an object definition into native PHP code that, when executed, creates the object.

##### Tags

author

  Matthieu Napoli matthieu@mnapoli.fr

### Table of Contents

#### Properties

$compiler : Compiler

#### Methods

__construct() : mixed
compile() : string
resolveParameters() : array<string|int, mixed>
assertClassIsInstantiable() : void
assertClassIsNotAnonymous() : void
compileLazyDefinition() : string
getFunctionName() : string
getParameterDefaultValue() : mixed
  Returns the default value of a function parameter.

### Properties

#### $compiler

ObjectCreationCompiler.php : 23
`private Compiler $compiler`

### Methods

#### __construct()

ObjectCreationCompiler.php : 22
`public __construct(Compiler $compiler) : mixed`

##### Parameters

$compiler : Compiler

#### compile()

ObjectCreationCompiler.php : 27
`public compile(ObjectDefinition $definition) : string`

##### Parameters

$definition : ObjectDefinition

##### Return values

string

#### resolveParameters()

ObjectCreationCompiler.php : 99
`public resolveParameters(MethodInjection|null $definition, ReflectionMethod|null $method) : array<string|int, mixed>`

##### Parameters

$definition : MethodInjection|null
$method : ReflectionMethod|null

##### Return values

array<string|int, mixed>

#### assertClassIsInstantiable()

ObjectCreationCompiler.php : 188
`private assertClassIsInstantiable(ObjectDefinition $definition) : void`

##### Parameters

$definition : ObjectDefinition

#### assertClassIsNotAnonymous()

ObjectCreationCompiler.php : 178
`private assertClassIsNotAnonymous(ObjectDefinition $definition) : void`

##### Parameters

$definition : ObjectDefinition

#### compileLazyDefinition()

ObjectCreationCompiler.php : 131
`private compileLazyDefinition(ObjectDefinition $definition) : string`

##### Parameters

$definition : ObjectDefinition

##### Return values

string

#### getFunctionName()

ObjectCreationCompiler.php : 173
`private getFunctionName(ReflectionMethod $method) : string`

##### Parameters

$method : ReflectionMethod

##### Return values

string

#### getParameterDefaultValue()

ObjectCreationCompiler.php : 159

Returns the default value of a function parameter.

`private getParameterDefaultValue(ReflectionParameter $parameter, ReflectionMethod $function) : mixed`

##### Parameters

$parameter : ReflectionParameter
$function : ReflectionMethod

##### Tags

throws
  InvalidDefinition

  Can't get default values from PHP internal classes and functions

## Search results