PHP Class Symfony\Component\DependencyInjection\Definition

Author: Fabien Potencier ([email protected])
Show file Open project: symfony/symfony Class Usage Examples

Protected Properties

Property Type Description
$arguments

Public Methods

Method Description
__construct ( string | null $class = null, array $arguments = [] )
addArgument ( mixed $argument ) : Definition Adds an argument to pass to the service constructor/factory method.
addAutowiringType ( string $type ) : Definition Adds a type that will default to this definition.
addMethodCall ( string $method, array $arguments = [] ) : Definition Adds a method to call after service initialization.
addTag ( string $name, array $attributes = [] ) : Definition Adds a tag for this definition.
clearTag ( string $name ) : Definition Clears all tags for a given name.
clearTags ( ) : Definition Clears the tags for this definition.
getArgument ( integer $index ) : mixed Gets an argument to pass to the service constructor/factory method.
getArguments ( ) : array Gets the arguments to pass to the service constructor/factory method.
getAutowiredMethods ( ) : string[] Gets autowired methods.
getAutowiringTypes ( ) : string[] Gets autowiring types that will default to this definition.
getClass ( ) : string | null Gets the service class.
getConfigurator ( ) : callable | null Gets the configurator to call after the service is fully initialized.
getDecoratedService ( ) : null | array Gets the service that decorates this service.
getDeprecationMessage ( string $id ) : string Message to use if this definition is deprecated.
getFactory ( ) : string | array Gets the factory.
getFile ( ) : string | null Gets the file to require before creating the service.
getMethodCalls ( ) : array Gets the methods to call after service initialization.
getProperties ( )
getTag ( string $name ) : array Gets a tag by name.
getTags ( ) : array Returns all tags.
hasAutowiringType ( string $type ) : boolean Will this definition default for the given type?
hasMethodCall ( string $method ) : boolean Check if the current definition has a given method to call after service initialization.
hasTag ( string $name ) : boolean Whether this definition has a tag with the given name.
isAbstract ( ) : boolean Whether this definition is abstract, that means it merely serves as a template for other definitions.
isAutowired ( ) : boolean Is the definition autowired?
isDeprecated ( ) : boolean Whether this definition is deprecated, that means it should not be called anymore.
isLazy ( ) : boolean Whether this service is lazy.
isPublic ( ) : boolean Whether this service is public facing.
isShared ( ) : boolean Whether this service is shared.
isSynthetic ( ) : boolean Whether this definition is synthetic, that is not constructed by the container, but dynamically injected.
removeAutowiringType ( string $type ) : Definition Removes a type.
removeMethodCall ( string $method ) : Definition Removes a method to call after service initialization.
replaceArgument ( integer $index, mixed $argument ) : Definition Sets a specific argument.
setAbstract ( boolean $boolean ) : Definition Whether this definition is abstract, that means it merely serves as a template for other definitions.
setArguments ( array $arguments ) : Definition Sets the arguments to pass to the service constructor/factory method.
setAutowired ( boolean $autowired ) : Definition Sets autowired.
setAutowiredMethods ( array $autowiredMethods ) : Definition Sets autowired methods.
setAutowiringTypes ( array $types ) : Definition Sets types that will default to this definition.
setClass ( string $class ) : Definition Sets the service class.
setConfigurator ( string | array $configurator ) : Definition Sets a configurator to call after the service is fully initialized.
setDecoratedService ( null | string $id, null | string $renamedId = null, integer $priority ) : Definition Sets the service that this service is decorating.
setDeprecated ( boolean $status = true, string $template = null ) : Definition Whether this definition is deprecated, that means it should not be called anymore.
setFactory ( string | array $factory ) : Definition Sets a factory.
setFile ( string $file ) : Definition Sets a file to require before creating the service.
setLazy ( boolean $lazy ) : Definition Sets the lazy flag of this service.
setMethodCalls ( array $calls = [] ) : Definition Sets the methods to call after service initialization.
setProperties ( array $properties )
setProperty ( $name, $value )
setPublic ( boolean $boolean ) : Definition Sets the visibility of this service.
setShared ( boolean $shared ) : Definition Sets if the service must be shared or not.
setSynthetic ( boolean $boolean ) : Definition Sets whether this definition is synthetic, that is not constructed by the container, but dynamically injected.
setTags ( array $tags ) : Definition Sets tags for this definition.

Method Details

__construct() public method

public __construct ( string | null $class = null, array $arguments = [] )
$class string | null The service class
$arguments array An array of arguments to pass to the service constructor

addArgument() public method

Adds an argument to pass to the service constructor/factory method.
public addArgument ( mixed $argument ) : Definition
$argument mixed An argument
return Definition The current instance

addAutowiringType() public method

Adds a type that will default to this definition.
public addAutowiringType ( string $type ) : Definition
$type string
return Definition The current instance

addMethodCall() public method

Adds a method to call after service initialization.
public addMethodCall ( string $method, array $arguments = [] ) : Definition
$method string The method name to call
$arguments array An array of arguments to pass to the method call
return Definition The current instance

addTag() public method

Adds a tag for this definition.
public addTag ( string $name, array $attributes = [] ) : Definition
$name string The tag name
$attributes array An array of attributes
return Definition The current instance

clearTag() public method

Clears all tags for a given name.
public clearTag ( string $name ) : Definition
$name string The tag name
return Definition

clearTags() public method

Clears the tags for this definition.
public clearTags ( ) : Definition
return Definition The current instance

getArgument() public method

Gets an argument to pass to the service constructor/factory method.
public getArgument ( integer $index ) : mixed
$index integer
return mixed The argument value

getArguments() public method

Gets the arguments to pass to the service constructor/factory method.
public getArguments ( ) : array
return array The array of arguments

getAutowiredMethods() public method

Gets autowired methods.
public getAutowiredMethods ( ) : string[]
return string[]

getAutowiringTypes() public method

Gets autowiring types that will default to this definition.
public getAutowiringTypes ( ) : string[]
return string[]

getClass() public method

Gets the service class.
public getClass ( ) : string | null
return string | null The service class

getConfigurator() public method

Gets the configurator to call after the service is fully initialized.
public getConfigurator ( ) : callable | null
return callable | null The PHP callable to call

getDecoratedService() public method

Gets the service that decorates this service.
public getDecoratedService ( ) : null | array
return 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

getDeprecationMessage() public method

Message to use if this definition is deprecated.
public getDeprecationMessage ( string $id ) : string
$id string Service id relying on this definition
return string

getFactory() public method

Gets the factory.
public getFactory ( ) : string | array
return string | array The PHP function or an array containing a class/Reference and a method to call

getFile() public method

Gets the file to require before creating the service.
public getFile ( ) : string | null
return string | null The full pathname to include

getMethodCalls() public method

Gets the methods to call after service initialization.
public getMethodCalls ( ) : array
return array An array of method calls

getProperties() public method

public getProperties ( )

getTag() public method

Gets a tag by name.
public getTag ( string $name ) : array
$name string The tag name
return array An array of attributes

getTags() public method

Returns all tags.
public getTags ( ) : array
return array An array of tags

hasAutowiringType() public method

Will this definition default for the given type?
public hasAutowiringType ( string $type ) : boolean
$type string
return boolean

hasMethodCall() public method

Check if the current definition has a given method to call after service initialization.
public hasMethodCall ( string $method ) : boolean
$method string The method name to search for
return boolean

hasTag() public method

Whether this definition has a tag with the given name.
public hasTag ( string $name ) : boolean
$name string
return boolean

isAbstract() public method

Whether this definition is abstract, that means it merely serves as a template for other definitions.
public isAbstract ( ) : boolean
return boolean

isAutowired() public method

Is the definition autowired?
public isAutowired ( ) : boolean
return boolean

isDeprecated() public method

Whether this definition is deprecated, that means it should not be called anymore.
public isDeprecated ( ) : boolean
return boolean

isLazy() public method

Whether this service is lazy.
public isLazy ( ) : boolean
return boolean

isPublic() public method

Whether this service is public facing.
public isPublic ( ) : boolean
return boolean

isShared() public method

Whether this service is shared.
public isShared ( ) : boolean
return boolean

isSynthetic() public method

Whether this definition is synthetic, that is not constructed by the container, but dynamically injected.
public isSynthetic ( ) : boolean
return boolean

removeAutowiringType() public method

Removes a type.
public removeAutowiringType ( string $type ) : Definition
$type string
return Definition The current instance

removeMethodCall() public method

Removes a method to call after service initialization.
public removeMethodCall ( string $method ) : Definition
$method string The method name to remove
return Definition The current instance

replaceArgument() public method

Sets a specific argument.
public replaceArgument ( integer $index, mixed $argument ) : Definition
$index integer
$argument mixed
return Definition The current instance

setAbstract() public method

Whether this definition is abstract, that means it merely serves as a template for other definitions.
public setAbstract ( boolean $boolean ) : Definition
$boolean boolean
return Definition the current instance

setArguments() public method

Sets the arguments to pass to the service constructor/factory method.
public setArguments ( array $arguments ) : Definition
$arguments array An array of arguments
return Definition The current instance

setAutowired() public method

Allowed values: - true: constructor autowiring, same as $this->setAutowiredMethods(array('__construct')) - false: no autowiring, same as $this->setAutowiredMethods(array())
public setAutowired ( boolean $autowired ) : Definition
$autowired boolean
return Definition The current instance

setAutowiredMethods() public method

Example of allowed value: - array('__construct', 'set*', 'initialize'): autowire whitelisted methods only
public setAutowiredMethods ( array $autowiredMethods ) : Definition
$autowiredMethods array
return Definition The current instance

setAutowiringTypes() public method

Sets types that will default to this definition.
public setAutowiringTypes ( array $types ) : Definition
$types array
return Definition The current instance

setClass() public method

Sets the service class.
public setClass ( string $class ) : Definition
$class string The service class
return Definition The current instance

setConfigurator() public method

Sets a configurator to call after the service is fully initialized.
public setConfigurator ( string | array $configurator ) : Definition
$configurator string | array A PHP callable
return Definition The current instance

setDecoratedService() public method

Sets the service that this service is decorating.
public setDecoratedService ( null | string $id, null | string $renamedId = null, integer $priority ) : Definition
$id null | string The decorated service id, use null to remove decoration
$renamedId null | string The new decorated service id
$priority integer The priority of decoration
return Definition The current instance

setDeprecated() public method

Whether this definition is deprecated, that means it should not be called anymore.
public setDeprecated ( boolean $status = true, string $template = null ) : Definition
$status boolean
$template string Template message to use if the definition is deprecated
return Definition the current instance

setFactory() public method

Sets a factory.
public setFactory ( string | array $factory ) : Definition
$factory string | array A PHP function or an array containing a class/Reference and a method to call
return Definition The current instance

setFile() public method

Sets a file to require before creating the service.
public setFile ( string $file ) : Definition
$file string A full pathname to include
return Definition The current instance

setLazy() public method

Sets the lazy flag of this service.
public setLazy ( boolean $lazy ) : Definition
$lazy boolean
return Definition The current instance

setMethodCalls() public method

Sets the methods to call after service initialization.
public setMethodCalls ( array $calls = [] ) : Definition
$calls array An array of method calls
return Definition The current instance

setProperties() public method

public setProperties ( array $properties )
$properties array

setProperty() public method

public setProperty ( $name, $value )

setPublic() public method

Sets the visibility of this service.
public setPublic ( boolean $boolean ) : Definition
$boolean boolean
return Definition The current instance

setShared() public method

Sets if the service must be shared or not.
public setShared ( boolean $shared ) : Definition
$shared boolean Whether the service must be shared or not
return Definition The current instance

setSynthetic() public method

Sets whether this definition is synthetic, that is not constructed by the container, but dynamically injected.
public setSynthetic ( boolean $boolean ) : Definition
$boolean boolean
return Definition the current instance

setTags() public method

Sets tags for this definition.
public setTags ( array $tags ) : Definition
$tags array
return Definition the current instance

Property Details

$arguments protected property

protected $arguments