class Definition

Definition represents a service definition.

Methods

__construct(string|null $class = null, array $arguments = array())

Constructor.

setFactory(string|array $factory)

Sets a factory.

string|array
getFactory()

Gets the factory.

setDecoratedService(null|string $id, null|string $renamedId = null, int $priority)

Sets the service that this service is decorating.

null|array
getDecoratedService()

Gets the service that decorates this service.

setClass(string $class)

Sets the service class.

string|null
getClass()

Gets the service class.

setArguments(array $arguments)

Sets the arguments to pass to the service constructor/factory method.

setProperties(array $properties)

No description

getProperties()

No description

setProperty($name, $value)

No description

addArgument(mixed $argument)

Adds an argument to pass to the service constructor/factory method.

replaceArgument(int $index, mixed $argument)

Sets a specific argument.

array
getArguments()

Gets the arguments to pass to the service constructor/factory method.

mixed
getArgument(int $index)

Gets an argument to pass to the service constructor/factory method.

setMethodCalls(array $calls = array())

Sets the methods to call after service initialization.

addMethodCall(string $method, array $arguments = array())

Adds a method to call after service initialization.

removeMethodCall(string $method)

Removes a method to call after service initialization.

bool
hasMethodCall(string $method)

Check if the current definition has a given method to call after service initialization.

array
getMethodCalls()

Gets the methods to call after service initialization.

setTags(array $tags)

Sets tags for this definition.

array
getTags()

Returns all tags.

array
getTag(string $name)

Gets a tag by name.

addTag(string $name, array $attributes = array())

Adds a tag for this definition.

bool
hasTag(string $name)

Whether this definition has a tag with the given name.

clearTag(string $name)

Clears all tags for a given name.

clearTags()

Clears the tags for this definition.

setFile(string $file)

Sets a file to require before creating the service.

string|null
getFile()

Gets the file to require before creating the service.

setShared(bool $shared)

Sets if the service must be shared or not.

bool
isShared()

Whether this service is shared.

setPublic(bool $boolean)

Sets the visibility of this service.

bool
isPublic()

Whether this service is public facing.

setLazy(bool $lazy)

Sets the lazy flag of this service.

bool
isLazy()

Whether this service is lazy.

setSynthetic(bool $boolean)

Sets whether this definition is synthetic, that is not constructed by the container, but dynamically injected.

bool
isSynthetic()

Whether this definition is synthetic, that is not constructed by the container, but dynamically injected.

setAbstract(bool $boolean)

Whether this definition is abstract, that means it merely serves as a template for other definitions.

bool
isAbstract()

Whether this definition is abstract, that means it merely serves as a template for other definitions.

setDeprecated(bool $status = true, string $template = null)

Whether this definition is deprecated, that means it should not be called anymore.

bool
isDeprecated()

Whether this definition is deprecated, that means it should not be called anymore.

string
getDeprecationMessage(string $id)

Message to use if this definition is deprecated.

setConfigurator(callable $callable)

Sets a configurator to call after the service is fully initialized.

callable|null
getConfigurator()

Gets the configurator to call after the service is fully initialized.

setAutowiringTypes(array $types)

Sets types that will default to this definition.

bool
isAutowired()

Is the definition autowired?

setAutowired($autowired)

Sets autowired.

string[]
getAutowiringTypes()

Gets autowiring types that will default to this definition.

addAutowiringType(string $type)

Adds a type that will default to this definition.

removeAutowiringType(string $type)

Removes a type.

bool
hasAutowiringType(string $type)

Will this definition default for the given type?

Details

at line line 50
__construct(string|null $class = null, array $arguments = array())

Constructor.

Parameters

string|null $class The service class
array $arguments An array of arguments to pass to the service constructor

at line line 63
Definition setFactory(string|array $factory)

Sets a factory.

Parameters

string|array $factory A PHP function or an array containing a class/Reference and a method to call

Return Value

Definition The current instance

at line line 79
string|array getFactory()

Gets the factory.

Return Value

string|array The PHP function or an array containing a class/Reference and a method to call

at line line 95
Definition setDecoratedService(null|string $id, null|string $renamedId = null, int $priority)

Sets the service that this service is decorating.

Parameters

null|string $id The decorated service id, use null to remove decoration
null|string $renamedId The new decorated service id
int $priority The priority of decoration

Return Value

Definition The current instance

Exceptions

InvalidArgumentException In case the decorated service id and the new decorated service id are equals.

at line line 115
null|array getDecoratedService()

Gets the service that decorates this service.

Return Value

null|array An array composed of the decorated service id, the new id for it and the priority of decoration, null if no service is decorated

at line line 127
Definition setClass(string $class)

Sets the service class.

Parameters

string $class The service class

Return Value

Definition The current instance

at line line 139
string|null getClass()

Gets the service class.

Return Value

string|null The service class

at line line 151
Definition setArguments(array $arguments)

Sets the arguments to pass to the service constructor/factory method.

Parameters

array $arguments An array of arguments

Return Value

Definition The current instance

at line line 158
setProperties(array $properties)

Parameters

array $properties

at line line 165
getProperties()

at line line 170
setProperty($name, $value)

Parameters

$name
$value

at line line 184
Definition addArgument(mixed $argument)

Adds an argument to pass to the service constructor/factory method.

Parameters

mixed $argument An argument

Return Value

Definition The current instance

at line line 201
Definition replaceArgument(int $index, mixed $argument)

Sets a specific argument.

Parameters

int $index
mixed $argument

Return Value

Definition The current instance

Exceptions

OutOfBoundsException When the replaced argument does not exist

at line line 217
array getArguments()

Gets the arguments to pass to the service constructor/factory method.

Return Value

array The array of arguments

at line line 231
mixed getArgument(int $index)

Gets an argument to pass to the service constructor/factory method.

Parameters

int $index

Return Value

mixed The argument value

Exceptions

OutOfBoundsException When the argument does not exist

at line line 247
Definition setMethodCalls(array $calls = array())

Sets the methods to call after service initialization.

Parameters

array $calls An array of method calls

Return Value

Definition The current instance

at line line 267
Definition addMethodCall(string $method, array $arguments = array())

Adds a method to call after service initialization.

Parameters

string $method The method name to call
array $arguments An array of arguments to pass to the method call

Return Value

Definition The current instance

Exceptions

InvalidArgumentException on empty $method param

at line line 284
Definition removeMethodCall(string $method)

Removes a method to call after service initialization.

Parameters

string $method The method name to remove

Return Value

Definition The current instance

at line line 303
bool hasMethodCall(string $method)

Check if the current definition has a given method to call after service initialization.

Parameters

string $method The method name to search for

Return Value

bool

at line line 319
array getMethodCalls()

Gets the methods to call after service initialization.

Return Value

array An array of method calls

at line line 331
Definition setTags(array $tags)

Sets tags for this definition.

Parameters

array $tags

Return Value

Definition the current instance

at line line 343
array getTags()

Returns all tags.

Return Value

array An array of tags

at line line 355
array getTag(string $name)

Gets a tag by name.

Parameters

string $name The tag name

Return Value

array An array of attributes

at line line 368
Definition addTag(string $name, array $attributes = array())

Adds a tag for this definition.

Parameters

string $name The tag name
array $attributes An array of attributes

Return Value

Definition The current instance

at line line 382
bool hasTag(string $name)

Whether this definition has a tag with the given name.

Parameters

string $name

Return Value

bool

at line line 394
Definition clearTag(string $name)

Clears all tags for a given name.

Parameters

string $name The tag name

Return Value

Definition

at line line 406
Definition clearTags()

Clears the tags for this definition.

Return Value

Definition The current instance

at line line 420
Definition setFile(string $file)

Sets a file to require before creating the service.

Parameters

string $file A full pathname to include

Return Value

Definition The current instance

at line line 432
string|null getFile()

Gets the file to require before creating the service.

Return Value

string|null The full pathname to include

at line line 444
Definition setShared(bool $shared)

Sets if the service must be shared or not.

Parameters

bool $shared Whether the service must be shared or not

Return Value

Definition The current instance

at line line 456
bool isShared()

Whether this service is shared.

Return Value

bool

at line line 468
Definition setPublic(bool $boolean)

Sets the visibility of this service.

Parameters

bool $boolean

Return Value

Definition The current instance

at line line 480
bool isPublic()

Whether this service is public facing.

Return Value

bool

at line line 492
Definition setLazy(bool $lazy)

Sets the lazy flag of this service.

Parameters

bool $lazy

Return Value

Definition The current instance

at line line 504
bool isLazy()

Whether this service is lazy.

Return Value

bool

at line line 517
Definition setSynthetic(bool $boolean)

Sets whether this definition is synthetic, that is not constructed by the container, but dynamically injected.

Parameters

bool $boolean

Return Value

Definition the current instance

at line line 530
bool isSynthetic()

Whether this definition is synthetic, that is not constructed by the container, but dynamically injected.

Return Value

bool

at line line 543
Definition setAbstract(bool $boolean)

Whether this definition is abstract, that means it merely serves as a template for other definitions.

Parameters

bool $boolean

Return Value

Definition the current instance

at line line 556
bool isAbstract()

Whether this definition is abstract, that means it merely serves as a template for other definitions.

Return Value

bool

at line line 572
Definition setDeprecated(bool $status = true, string $template = null)

Whether this definition is deprecated, that means it should not be called anymore.

Parameters

bool $status
string $template Template message to use if the definition is deprecated

Return Value

Definition the current instance

Exceptions

InvalidArgumentException When the message template is invalid.

at line line 597
bool isDeprecated()

Whether this definition is deprecated, that means it should not be called anymore.

Return Value

bool

at line line 609
string getDeprecationMessage(string $id)

Message to use if this definition is deprecated.

Parameters

string $id Service id relying on this definition

Return Value

string

at line line 621
Definition setConfigurator(callable $callable)

Sets a configurator to call after the service is fully initialized.

Parameters

callable $callable A PHP callable

Return Value

Definition The current instance

at line line 633
callable|null getConfigurator()

Gets the configurator to call after the service is fully initialized.

Return Value

callable|null The PHP callable to call

at line line 645
Definition setAutowiringTypes(array $types)

Sets types that will default to this definition.

Parameters

array $types

Return Value

Definition The current instance

at line line 661
bool isAutowired()

Is the definition autowired?

Return Value

bool

at line line 673
Definition setAutowired($autowired)

Sets autowired.

Parameters

$autowired

Return Value

Definition The current instance

at line line 685
string[] getAutowiringTypes()

Gets autowiring types that will default to this definition.

Return Value

string[]

at line line 697
Definition addAutowiringType(string $type)

Adds a type that will default to this definition.

Parameters

string $type

Return Value

Definition The current instance

at line line 711
Definition removeAutowiringType(string $type)

Removes a type.

Parameters

string $type

Return Value

Definition The current instance

at line line 725
bool hasAutowiringType(string $type)

Will this definition default for the given type?

Parameters

string $type

Return Value

bool