Menu

## ObjectDefinition
in package
implements Definition

ObjectDefinition.php : 18

Defines how an object can be instantiated.

##### Tags

author

  Matthieu Napoli matthieu@mnapoli.fr

### Table of Contents

#### Interfaces

Definition

#### Properties

$className : string|null
  Class name (if null, then the class name is $name).
$constructorInjection : MethodInjection|null
$lazy : bool|null
$methodInjections : array<string|int, array<string|int, MethodInjection>>
  Method calls.
$propertyInjections : array<string|int, mixed>
$classExists : bool
  Store if the class exists. Storing it (in cache) avoids recomputing this.
$isInstantiable : bool
  Store if the class is instantiable. Storing it (in cache) avoids recomputing this.
$name : string
  Entry name (most of the time, same as $classname).

#### Methods

__construct() : mixed
__toString() : string
addMethodInjection() : void
addPropertyInjection() : void
classExists() : bool
completeConstructorInjection() : void
completeFirstMethodInjection() : void
getClassName() : string
getConstructorInjection() : MethodInjection|null
getMethodInjections() : array<string|int, MethodInjection>
getName() : string
getPropertyInjections() : array<string|int, PropertyInjection>
isInstantiable() : bool
isLazy() : bool
replaceNestedDefinitions() : void
replaceWildcards() : void
  Replaces all the wildcards in the string with the given replacements.
setClassName() : void
setConstructorInjection() : void
setLazy() : void
setName() : void
updateCache() : void

### Properties

#### $className

ObjectDefinition.php : 28

Class name (if null, then the class name is $name).

`protected string|null $className = null`

#### $constructorInjection

ObjectDefinition.php : 30
`protected MethodInjection|null $constructorInjection = null`

#### $lazy

ObjectDefinition.php : 40
`protected bool|null $lazy = null`

#### $methodInjections

ObjectDefinition.php : 38

Method calls.

`protected array<string|int, array<string|int, MethodInjection>> $methodInjections = []`

#### $propertyInjections

ObjectDefinition.php : 32
`protected array<string|int, mixed> $propertyInjections = []`

#### $classExists

ObjectDefinition.php : 45

Store if the class exists. Storing it (in cache) avoids recomputing this.

`private bool $classExists`

#### $isInstantiable

ObjectDefinition.php : 50

Store if the class is instantiable. Storing it (in cache) avoids recomputing this.

`private bool $isInstantiable`

#### $name

ObjectDefinition.php : 23

Entry name (most of the time, same as $classname).

`private string $name`

### Methods

#### __construct()

ObjectDefinition.php : 55
`public __construct(string $name[, string|null $className = null ]) : mixed`

##### Parameters

$name : string

  Entry name

$className : string|null = null

#### __toString()

ObjectDefinition.php : 221
`public __toString() : string`

##### Return values

string

#### addMethodInjection()

ObjectDefinition.php : 140
`public addMethodInjection(MethodInjection $methodInjection) : void`

##### Parameters

$methodInjection : MethodInjection

#### addPropertyInjection()

ObjectDefinition.php : 112
`public addPropertyInjection(PropertyInjection $propertyInjection) : void`

##### Parameters

$propertyInjection : PropertyInjection

#### classExists()

ObjectDefinition.php : 177
`public classExists() : bool`

##### Return values

bool

#### completeConstructorInjection()

ObjectDefinition.php : 93
`public completeConstructorInjection(MethodInjection $injection) : void`

##### Parameters

$injection : MethodInjection

#### completeFirstMethodInjection()

ObjectDefinition.php : 149
`public completeFirstMethodInjection(MethodInjection $injection) : void`

##### Parameters

$injection : MethodInjection

#### getClassName()

ObjectDefinition.php : 78
`public getClassName() : string`

##### Return values

string

#### getConstructorInjection()

ObjectDefinition.php : 83
`public getConstructorInjection() : MethodInjection|null`

##### Return values

MethodInjection|null

#### getMethodInjections()

ObjectDefinition.php : 129
`public getMethodInjections() : array<string|int, MethodInjection>`

##### Return values

array<string|int, MethodInjection> —

Method injections

#### getName()

ObjectDefinition.php : 61
`public getName() : string`

##### Return values

string

#### getPropertyInjections()

ObjectDefinition.php : 107
`public getPropertyInjections() : array<string|int, PropertyInjection>`

##### Return values

array<string|int, PropertyInjection> —

Property injections

#### isInstantiable()

ObjectDefinition.php : 182
`public isInstantiable() : bool`

##### Return values

bool

#### isLazy()

ObjectDefinition.php : 167
`public isLazy() : bool`

##### Return values

bool

#### replaceNestedDefinitions()

ObjectDefinition.php : 187
`public replaceNestedDefinitions(callable $replacer) : void`

##### Parameters

$replacer : callable

#### replaceWildcards()

ObjectDefinition.php : 207

Replaces all the wildcards in the string with the given replacements.

`public replaceWildcards(array<string|int, string> $replacements) : void`

##### Parameters

$replacements : array<string|int, string>

#### setClassName()

ObjectDefinition.php : 71
`public setClassName(string|null $className) : void`

##### Parameters

$className : string|null

#### setConstructorInjection()

ObjectDefinition.php : 88
`public setConstructorInjection(MethodInjection $constructorInjection) : void`

##### Parameters

$constructorInjection : MethodInjection

#### setLazy()

ObjectDefinition.php : 162
`public setLazy([bool|null $lazy = null ]) : void`

##### Parameters

$lazy : bool|null = null

#### setName()

ObjectDefinition.php : 66
`public setName(string $name) : void`

##### Parameters

$name : string

#### updateCache()

ObjectDefinition.php : 226
`private updateCache() : void`

## Search results