PHP Class Nette\DI\Container

Author: David Grudl
Inheritance: extends Nette\FreezableObject, implements Nette\DI\IContainer
ファイルを表示 Open project: nette/di Class Usage Examples

Public Properties

Property Type Description
$parameters *private

Protected Properties

Property Type Description
$meta array[]

Public Methods

Method Description
__construct ( array $params = [] )
__get ( $name )
__isset ( $name )
__set ( $name, $service )
__unset ( $name )
addService ( $name, $service ) : self Adds the service to the container.
callInjects ( $service ) : void Calls all methods starting with with "inject" using autowiring.
callMethod ( callable $function, array $args = [] ) : mixed Calls method using autowiring.
createInstance ( $class, array $args = [] ) : object Creates new instance using autowiring.
createService ( $name, array $args = [] ) : object Creates new instance of the service.
expand ( $s ) : mixed Expands %placeholders%.
findByTag ( $tag ) : array Gets the service names of the specified tag.
findByType ( $class ) : string[] Gets the service names of the specified type.
getByType ( $class, $need = TRUE ) : object Resolves service by type.
getMethodName ( $name )
getParameters ( ) : array
getService ( $name ) : object Gets the service object by name.
getServiceType ( $name ) : string Gets the service type by name.
hasService ( $name ) : boolean Does the service exist?
isCreated ( $name ) : boolean Is the service created?
removeService ( $name ) : void Removes the service from the container.

Method Details

__construct() public method

public __construct ( array $params = [] )
$params array

__get() public method

Deprecation:
public __get ( $name )

__isset() public method

Deprecation:
public __isset ( $name )

__set() public method

Deprecation:
public __set ( $name, $service )

__unset() public method

Deprecation:
public __unset ( $name )

addService() public method

Adds the service to the container.
public addService ( $name, $service ) : self
return self

callInjects() public method

Calls all methods starting with with "inject" using autowiring.
public callInjects ( $service ) : void
return void

callMethod() public method

Calls method using autowiring.
public callMethod ( callable $function, array $args = [] ) : mixed
$function callable
$args array
return mixed

createInstance() public method

Creates new instance using autowiring.
public createInstance ( $class, array $args = [] ) : object
$args array
return object

createService() public method

Creates new instance of the service.
public createService ( $name, array $args = [] ) : object
$args array
return object

expand() public method

Expands %placeholders%.
Deprecation:
public expand ( $s ) : mixed
return mixed

findByTag() public method

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

findByType() public method

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

getByType() public method

Resolves service by type.
public getByType ( $class, $need = TRUE ) : object
return object service or NULL

getMethodName() public static method

public static getMethodName ( $name )

getParameters() public method

public getParameters ( ) : array
return array

getService() public method

Gets the service object by name.
public getService ( $name ) : object
return object

getServiceType() public method

Gets the service type by name.
public getServiceType ( $name ) : string
return string

hasService() public method

Does the service exist?
public hasService ( $name ) : boolean
return boolean

isCreated() public method

Is the service created?
public isCreated ( $name ) : boolean
return boolean

removeService() public method

Removes the service from the container.
public removeService ( $name ) : void
return void

Property Details

$meta protected_oe property

protected array[] $meta
return array[]

$parameters public_oe property

*private
public $parameters