Definition
in package
Definition represents a service definition.
Tags
Table of Contents
- DEFAULT_DEPRECATION_TEMPLATE = 'The "%service_id%" service is deprecated. You should stop using it, as it will be removed in the future.'
- $arguments : mixed
- $abstract : mixed
- $autoconfigured : mixed
- $autowired : mixed
- $bindings : mixed
- $calls : mixed
- $changes : mixed
- $class : mixed
- $configurator : mixed
- $decoratedService : mixed
- $deprecation : mixed
- $errors : mixed
- $factory : mixed
- $file : mixed
- $instanceof : mixed
- $lazy : mixed
- $properties : mixed
- $public : mixed
- $shared : mixed
- $synthetic : mixed
- $tags : mixed
- __construct() : mixed
- addArgument() : $this
- Adds an argument to pass to the service constructor/factory method.
- addError() : $this
- Add an error that occurred when building this Definition.
- addMethodCall() : $this
- Adds a method to call after service initialization.
- addTag() : $this
- Adds a tag for this definition.
- clearTag() : $this
- Clears all tags for a given name.
- clearTags() : $this
- Clears the tags for this definition.
- getArgument() : mixed
- Gets an argument to pass to the service constructor/factory method.
- getArguments() : array<string|int, mixed>
- Gets the arguments to pass to the service constructor/factory method.
- getBindings() : array<string|int, BoundArgument>
- Gets bindings.
- getChanges() : array<string|int, mixed>
- Returns all changes tracked for the Definition object.
- getClass() : string|null
- Gets the service class.
- getConfigurator() : string|array<string|int, mixed>|null
- Gets the configurator to call after the service is fully initialized.
- getDecoratedService() : array<string|int, mixed>|null
- Gets the service that this service is decorating.
- getDeprecation() : array<string|int, mixed>
- getDeprecationMessage() : string
- Message to use if this definition is deprecated.
- getErrors() : array<string|int, mixed>
- Returns any errors that occurred while building this Definition.
- getFactory() : string|array<string|int, mixed>|null
- Gets the factory.
- getFile() : string|null
- Gets the file to require before creating the service.
- getInstanceofConditionals() : array<string|int, ChildDefinition>
- Gets the definition templates to conditionally apply on the current definition, keyed by parent interface/class.
- getMethodCalls() : array<string|int, mixed>
- Gets the methods to call after service initialization.
- getProperties() : array<string|int, mixed>
- Gets the properties to define when creating the service.
- getTag() : array<string|int, mixed>
- Gets a tag by name.
- getTags() : array<string|int, mixed>
- Returns all tags.
- hasErrors() : bool
- hasMethodCall() : bool
- Check if the current definition has a given method to call after service initialization.
- hasTag() : bool
- Whether this definition has a tag with the given name.
- isAbstract() : bool
- Whether this definition is abstract, that means it merely serves as a template for other definitions.
- isAutoconfigured() : bool
- isAutowired() : bool
- Is the definition autowired?
- isDeprecated() : bool
- Whether this definition is deprecated, that means it should not be called anymore.
- isLazy() : bool
- Whether this service is lazy.
- isPrivate() : bool
- Whether this service is private.
- isPublic() : bool
- Whether this service is public facing.
- isShared() : bool
- Whether this service is shared.
- isSynthetic() : bool
- Whether this definition is synthetic, that is not constructed by the container, but dynamically injected.
- removeMethodCall() : $this
- Removes a method to call after service initialization.
- replaceArgument() : $this
- Replaces a specific argument.
- setAbstract() : $this
- Whether this definition is abstract, that means it merely serves as a template for other definitions.
- setArgument() : $this
- Sets a specific argument.
- setArguments() : $this
- Sets the arguments to pass to the service constructor/factory method.
- setAutoconfigured() : $this
- Sets whether or not instanceof conditionals should be prepended with a global set.
- setAutowired() : $this
- Enables/disables autowiring.
- setBindings() : $this
- Sets bindings.
- setChanges() : $this
- Sets the tracked changes for the Definition object.
- setClass() : $this
- Sets the service class.
- setConfigurator() : $this
- Sets a configurator to call after the service is fully initialized.
- setDecoratedService() : $this
- Sets the service that this service is decorating.
- setDeprecated() : $this
- Whether this definition is deprecated, that means it should not be called anymore.
- setFactory() : $this
- Sets a factory.
- setFile() : $this
- Sets a file to require before creating the service.
- setInstanceofConditionals() : $this
- Sets the definition templates to conditionally apply on the current definition, keyed by parent interface/class.
- setLazy() : $this
- Sets the lazy flag of this service.
- setMethodCalls() : $this
- Sets the methods to call after service initialization.
- setPrivate() : $this
- Sets if this service is private.
- setProperties() : $this
- Sets the properties to define when creating the service.
- setProperty() : $this
- Sets a specific property.
- setPublic() : $this
- Sets the visibility of this service.
- setShared() : $this
- Sets if the service must be shared or not.
- setSynthetic() : $this
- Sets whether this definition is synthetic, that is not constructed by the container, but dynamically injected.
- setTags() : $this
- Sets tags for this definition.
Constants
DEFAULT_DEPRECATION_TEMPLATE
private
mixed
DEFAULT_DEPRECATION_TEMPLATE
= 'The "%service_id%" service is deprecated. You should stop using it, as it will be removed in the future.'
Properties
$arguments
protected
mixed
$arguments
= []
$abstract
private
mixed
$abstract
= false
$autoconfigured
private
mixed
$autoconfigured
= false
$autowired
private
mixed
$autowired
= false
$bindings
private
mixed
$bindings
= []
$calls
private
mixed
$calls
= []
$changes
private
mixed
$changes
= []
$class
private
mixed
$class
$configurator
private
mixed
$configurator
$decoratedService
private
mixed
$decoratedService
$deprecation
private
mixed
$deprecation
= []
$errors
private
mixed
$errors
= []
$factory
private
mixed
$factory
$file
private
mixed
$file
$instanceof
private
mixed
$instanceof
= []
$lazy
private
mixed
$lazy
= false
$properties
private
mixed
$properties
= []
$public
private
mixed
$public
= false
$shared
private
mixed
$shared
= true
$synthetic
private
mixed
$synthetic
= false
$tags
private
mixed
$tags
= []
Methods
__construct()
public
__construct([string|null $class = null ][, array<string|int, mixed> $arguments = [] ]) : mixed
Parameters
- $class : string|null = null
- $arguments : array<string|int, mixed> = []
Return values
mixed —addArgument()
Adds an argument to pass to the service constructor/factory method.
public
addArgument(mixed $argument) : $this
Parameters
- $argument : mixed
-
An argument
Return values
$this —addError()
Add an error that occurred when building this Definition.
public
addError(string|Closure|self $error) : $this
Parameters
- $error : string|Closure|self
Return values
$this —addMethodCall()
Adds a method to call after service initialization.
public
addMethodCall(string $method[, array<string|int, mixed> $arguments = [] ][, bool $returnsClone = false ]) : $this
Parameters
- $method : string
-
The method name to call
- $arguments : array<string|int, mixed> = []
-
An array of arguments to pass to the method call
- $returnsClone : bool = false
-
Whether the call returns the service instance or not
Tags
Return values
$this —addTag()
Adds a tag for this definition.
public
addTag(string $name[, array<string|int, mixed> $attributes = [] ]) : $this
Parameters
- $name : string
- $attributes : array<string|int, mixed> = []
Return values
$this —clearTag()
Clears all tags for a given name.
public
clearTag(string $name) : $this
Parameters
- $name : string
Return values
$this —clearTags()
Clears the tags for this definition.
public
clearTags() : $this
Return values
$this —getArgument()
Gets an argument to pass to the service constructor/factory method.
public
getArgument(int|string $index) : mixed
Parameters
- $index : int|string
Tags
Return values
mixed —getArguments()
Gets the arguments to pass to the service constructor/factory method.
public
getArguments() : array<string|int, mixed>
Return values
array<string|int, mixed> —getBindings()
Gets bindings.
public
getBindings() : array<string|int, BoundArgument>
Return values
array<string|int, BoundArgument> —getChanges()
Returns all changes tracked for the Definition object.
public
getChanges() : array<string|int, mixed>
Return values
array<string|int, mixed> —getClass()
Gets the service class.
public
getClass() : string|null
Return values
string|null —getConfigurator()
Gets the configurator to call after the service is fully initialized.
public
getConfigurator() : string|array<string|int, mixed>|null
Return values
string|array<string|int, mixed>|null —getDecoratedService()
Gets the service that this service is decorating.
public
getDecoratedService() : array<string|int, mixed>|null
Return values
array<string|int, mixed>|null —An array composed of the decorated service id, the new id for it and the priority of decoration, null if no service is decorated
getDeprecation()
public
getDeprecation(string $id) : array<string|int, mixed>
Parameters
- $id : string
-
Service id relying on this definition
Return values
array<string|int, mixed> —getDeprecationMessage()
Message to use if this definition is deprecated.
public
getDeprecationMessage(string $id) : string
Parameters
- $id : string
-
Service id relying on this definition
Tags
Return values
string —getErrors()
Returns any errors that occurred while building this Definition.
public
getErrors() : array<string|int, mixed>
Return values
array<string|int, mixed> —getFactory()
Gets the factory.
public
getFactory() : string|array<string|int, mixed>|null
Return values
string|array<string|int, mixed>|null —The PHP function or an array containing a class/Reference and a method to call
getFile()
Gets the file to require before creating the service.
public
getFile() : string|null
Return values
string|null —getInstanceofConditionals()
Gets the definition templates to conditionally apply on the current definition, keyed by parent interface/class.
public
getInstanceofConditionals() : array<string|int, ChildDefinition>
Return values
array<string|int, ChildDefinition> —getMethodCalls()
Gets the methods to call after service initialization.
public
getMethodCalls() : array<string|int, mixed>
Return values
array<string|int, mixed> —getProperties()
Gets the properties to define when creating the service.
public
getProperties() : array<string|int, mixed>
Return values
array<string|int, mixed> —getTag()
Gets a tag by name.
public
getTag(string $name) : array<string|int, mixed>
Parameters
- $name : string
Return values
array<string|int, mixed> —getTags()
Returns all tags.
public
getTags() : array<string|int, mixed>
Return values
array<string|int, mixed> —hasErrors()
public
hasErrors() : bool
Return values
bool —hasMethodCall()
Check if the current definition has a given method to call after service initialization.
public
hasMethodCall(string $method) : bool
Parameters
- $method : string
Return values
bool —hasTag()
Whether this definition has a tag with the given name.
public
hasTag(string $name) : bool
Parameters
- $name : string
Return values
bool —isAbstract()
Whether this definition is abstract, that means it merely serves as a template for other definitions.
public
isAbstract() : bool
Return values
bool —isAutoconfigured()
public
isAutoconfigured() : bool
Return values
bool —isAutowired()
Is the definition autowired?
public
isAutowired() : bool
Return values
bool —isDeprecated()
Whether this definition is deprecated, that means it should not be called anymore.
public
isDeprecated() : bool
Return values
bool —isLazy()
Whether this service is lazy.
public
isLazy() : bool
Return values
bool —isPrivate()
Whether this service is private.
public
isPrivate() : bool
Return values
bool —isPublic()
Whether this service is public facing.
public
isPublic() : bool
Return values
bool —isShared()
Whether this service is shared.
public
isShared() : bool
Return values
bool —isSynthetic()
Whether this definition is synthetic, that is not constructed by the container, but dynamically injected.
public
isSynthetic() : bool
Return values
bool —removeMethodCall()
Removes a method to call after service initialization.
public
removeMethodCall(string $method) : $this
Parameters
- $method : string
Return values
$this —replaceArgument()
Replaces a specific argument.
public
replaceArgument(int|string $index, mixed $argument) : $this
Parameters
- $index : int|string
- $argument : mixed
Tags
Return values
$this —setAbstract()
Whether this definition is abstract, that means it merely serves as a template for other definitions.
public
setAbstract(bool $boolean) : $this
Parameters
- $boolean : bool
Return values
$this —setArgument()
Sets a specific argument.
public
setArgument(int|string $key, mixed $value) : $this
Parameters
- $key : int|string
- $value : mixed
Return values
$this —setArguments()
Sets the arguments to pass to the service constructor/factory method.
public
setArguments(array<string|int, mixed> $arguments) : $this
Parameters
- $arguments : array<string|int, mixed>
Return values
$this —setAutoconfigured()
Sets whether or not instanceof conditionals should be prepended with a global set.
public
setAutoconfigured(bool $autoconfigured) : $this
Parameters
- $autoconfigured : bool
Return values
$this —setAutowired()
Enables/disables autowiring.
public
setAutowired(bool $autowired) : $this
Parameters
- $autowired : bool
Return values
$this —setBindings()
Sets bindings.
public
setBindings(array<string|int, mixed> $bindings) : $this
Bindings map $named or FQCN arguments to values that should be injected in the matching parameters (of the constructor, of methods called and of controller actions).
Parameters
- $bindings : array<string|int, mixed>
Return values
$this —setChanges()
Sets the tracked changes for the Definition object.
public
setChanges(array<string|int, mixed> $changes) : $this
Parameters
- $changes : array<string|int, mixed>
-
An array of changes for this Definition
Return values
$this —setClass()
Sets the service class.
public
setClass(string|null $class) : $this
Parameters
- $class : string|null
Return values
$this —setConfigurator()
Sets a configurator to call after the service is fully initialized.
public
setConfigurator(string|array<string|int, mixed>|Reference|null $configurator) : $this
Parameters
- $configurator : string|array<string|int, mixed>|Reference|null
-
A PHP function, reference or an array containing a class/Reference and a method to call
Return values
$this —setDecoratedService()
Sets the service that this service is decorating.
public
setDecoratedService(string|null $id[, string|null $renamedId = null ], int $priority[, int $invalidBehavior = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE ]) : $this
Parameters
- $id : string|null
-
The decorated service id, use null to remove decoration
- $renamedId : string|null = null
-
The new decorated service id
- $priority : int
- $invalidBehavior : int = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE
Tags
Return values
$this —setDeprecated()
Whether this definition is deprecated, that means it should not be called anymore.
public
setDeprecated() : $this
Tags
Return values
$this —setFactory()
Sets a factory.
public
setFactory(string|array<string|int, mixed>|Reference|null $factory) : $this
Parameters
- $factory : string|array<string|int, mixed>|Reference|null
-
A PHP function, reference or an array containing a class/Reference and a method to call
Return values
$this —setFile()
Sets a file to require before creating the service.
public
setFile(string|null $file) : $this
Parameters
- $file : string|null
Return values
$this —setInstanceofConditionals()
Sets the definition templates to conditionally apply on the current definition, keyed by parent interface/class.
public
setInstanceofConditionals(array<string|int, ChildDefinition> $instanceof) : $this
Parameters
- $instanceof : array<string|int, ChildDefinition>
Return values
$this —setLazy()
Sets the lazy flag of this service.
public
setLazy(bool $lazy) : $this
Parameters
- $lazy : bool
Return values
$this —setMethodCalls()
Sets the methods to call after service initialization.
public
setMethodCalls([array<string|int, mixed> $calls = [] ]) : $this
Parameters
- $calls : array<string|int, mixed> = []
Return values
$this —setPrivate()
Sets if this service is private.
public
setPrivate(bool $boolean) : $this
Parameters
- $boolean : bool
Tags
Return values
$this —setProperties()
Sets the properties to define when creating the service.
public
setProperties(array<string|int, mixed> $properties) : $this
Parameters
- $properties : array<string|int, mixed>
Return values
$this —setProperty()
Sets a specific property.
public
setProperty(string $name, mixed $value) : $this
Parameters
- $name : string
- $value : mixed
Return values
$this —setPublic()
Sets the visibility of this service.
public
setPublic(bool $boolean) : $this
Parameters
- $boolean : bool
Return values
$this —setShared()
Sets if the service must be shared or not.
public
setShared(bool $shared) : $this
Parameters
- $shared : bool
Return values
$this —setSynthetic()
Sets whether this definition is synthetic, that is not constructed by the container, but dynamically injected.
public
setSynthetic(bool $boolean) : $this
Parameters
- $boolean : bool
Return values
$this —setTags()
Sets tags for this definition.
public
setTags(array<string|int, mixed> $tags) : $this
Parameters
- $tags : array<string|int, mixed>