PHP Class Nette\DI\ContainerBuilder

Inheritance: extends Nette\Object
Show file Open project: nette/di Class Usage Examples

Public Properties

Property Type Description
$parameters array

Public Methods

Method Description
addAlias ( $alias, $service )
addDefinition ( $name, ServiceDefinition $definition = NULL ) : ServiceDefinition Adds new service definition.
addDependency ( $dep ) : self Adds item to the list of dependencies.
addExcludedClasses ( array $classes ) : self
autowireArguments ( $class, $method, array $arguments ) : array Creates a list of arguments using autowiring.
complete ( ) : void
completeStatement ( Statement $statement ) : Statement
expand ( $value ) : mixed Expands %placeholders% in strings.
findByTag ( $tag ) : array Gets the service objects of the specified tag.
findByType ( $class ) : ServiceDefinition[] Gets the service names and definitions of the specified type.
formatPhp ( $statement, $args )
formatStatement ( Statement $statement )
generateClasses ( $className = 'Container', $parentName = NULL )
getAliases ( ) : array Gets all service aliases.
getByType ( $class ) : string | null Resolves service name by type.
getClassList ( )
getClassName ( )
getDefinition ( $name ) : ServiceDefinition Gets the service definition.
getDefinitions ( ) : ServiceDefinition[] Gets all service definitions.
getDependencies ( ) : array Returns the list of dependencies.
getServiceName ( $arg ) : string Converts @service or @\Class -> service name and checks its existence.
hasDefinition ( $name ) : boolean Does the service definition or alias exist?
literal ( $phpCode ) : Nette\PhpGenerator\PhpLiteral
normalizeEntity ( $entity )
prepareClassList ( ) : array Generates $dependencies, $classes and normalizes class names.
removeAlias ( $alias ) : void Removes the specified alias.
removeDefinition ( $name ) : void Removes the specified service definition.
setClassName ( $name )

Private Methods

Method Description
checkCase ( $class )
resolveEntityClass ( $entity, $recursive = [] ) : string | null
resolveImplement ( ServiceDefinition $def, $name )
resolveServiceClass ( $name, $recursive = [] ) : string | null

Method Details

addAlias() public method

public addAlias ( $alias, $service )

addDefinition() public method

Adds new service definition.
public addDefinition ( $name, ServiceDefinition $definition = NULL ) : ServiceDefinition
$definition ServiceDefinition
return ServiceDefinition

addDependency() public method

Adds item to the list of dependencies.
public addDependency ( $dep ) : self
return self

addExcludedClasses() public method

public addExcludedClasses ( array $classes ) : self
$classes array
return self

autowireArguments() public method

Creates a list of arguments using autowiring.
public autowireArguments ( $class, $method, array $arguments ) : array
$arguments array
return array

complete() public method

public complete ( ) : void
return void

completeStatement() public method

public completeStatement ( Statement $statement ) : Statement
$statement Statement
return Statement

expand() public method

Expands %placeholders% in strings.
Deprecation:
public expand ( $value ) : mixed
return mixed

findByTag() public method

Gets the service objects of the specified tag.
public findByTag ( $tag ) : array
return array of [service name => tag attributes]

findByType() public method

Gets the service names and definitions of the specified type.
public findByType ( $class ) : ServiceDefinition[]
return ServiceDefinition[]

formatPhp() public method

Deprecation:
public formatPhp ( $statement, $args )

formatStatement() public method

Deprecation:
public formatStatement ( Statement $statement )
$statement Statement

generateClasses() public method

Deprecation:
public generateClasses ( $className = 'Container', $parentName = NULL )

getAliases() public method

Gets all service aliases.
public getAliases ( ) : array
return array

getByType() public method

Resolves service name by type.
public getByType ( $class ) : string | null
return string | null service name or NULL

getClassList() public method

public getClassList ( )

getClassName() public method

Deprecation:
public getClassName ( )

getDefinition() public method

Gets the service definition.
public getDefinition ( $name ) : ServiceDefinition
return ServiceDefinition

getDefinitions() public method

Gets all service definitions.
public getDefinitions ( ) : ServiceDefinition[]
return ServiceDefinition[]

getDependencies() public method

Returns the list of dependencies.
public getDependencies ( ) : array
return array

getServiceName() public method

Converts @service or @\Class -> service name and checks its existence.
public getServiceName ( $arg ) : string
return string of FALSE, if argument is not service name

hasDefinition() public method

Does the service definition or alias exist?
public hasDefinition ( $name ) : boolean
return boolean

literal() public static method

public static literal ( $phpCode ) : Nette\PhpGenerator\PhpLiteral
return Nette\PhpGenerator\PhpLiteral

normalizeEntity() public method

public normalizeEntity ( $entity )

prepareClassList() public method

Generates $dependencies, $classes and normalizes class names.
public prepareClassList ( ) : array
return array

removeAlias() public method

Removes the specified alias.
public removeAlias ( $alias ) : void
return void

removeDefinition() public method

Removes the specified service definition.
public removeDefinition ( $name ) : void
return void

setClassName() public method

Deprecation:
public setClassName ( $name )

Property Details

$parameters public property

public array $parameters
return array