com\setasign\SetaFramework\Application
ApplicationDi Class ApplicationDi
File: /SetaFramework/src/Application/ApplicationDi.php
Class hierarchy
Summary
Methods
- __construct()
- __sleep()
- __wakeup()
- addAlias()
- addAliasWithInstancedObject()
- call()
- callNewInstance()
- clearInstance()
- configure()
- createView()
- createViewTwigEnvironment()
- get()
- getArguments()
- getByAlias()
- getByClassName()
- getDatabaseConnectionManager()
- getEventManager()
- getReflectionParameters()
- hasAlias()
- hasConfiguration()
- hasInstance()
- init()
- parentInjections()
- prepareParams()
- purgeName()
- remove()
- setupApplicationCacheHandler()
- setupApplicationLogHandler()
- setupCacheHandler()
- setupLogHandler()
Properties
Methods
__construct()
ApplicationDi constructor.
Parameters
- $application : ApplicationInterface
- $bootstrap : \com\setasign\SetaFramework\Bootstrap\Bootstrap
addAlias()
string|callable $classNameOrCallback,
array $params = array ( ),
bool $singleton = true
Add an alias configuration
Parameters
- $name : string
- $classNameOrCallback : string|callable
- $params : array
- $singleton : bool
Exceptions
Throws \com\setasign\SetaFramework\Di\AlreadyDefinedException
addAliasWithInstancedObject()
?object $instance
Parameters
- $name : string
- $instance : ?object
call()
array $parameters = array ( )
Call the callable and autowire the params.
Parameters
- $callable : callable
- $parameters : array
Return Values
Result of the callable
Exceptions
Throws \ReflectionException
callNewInstance()
array $parameters = array ( )
Create a new instance of $className and autowire the params.
Parameters
- $className : \com\setasign\SetaFramework\Di\class-string<\com\setasign\SetaFramework\Di\T>
- $parameters : array
Exceptions
Throws \ReflectionException
configure()
array $params = array ( ),
bool $singleton = true
Add a class/interface configuration
Parameters
- $className : string
- $params : array
- $singleton : bool
Exceptions
Throws \com\setasign\SetaFramework\Di\AlreadyDefinedException
createView()
Parameters
- $application : HttpApplicationInterface
createViewTwigEnvironment()
\com\setasign\SetaFramework\Bootstrap\Bootstrap $bootstrap,
ApplicationConfig $applicationConfig,
\com\setasign\SetaFramework\Bootstrap\DomainName $domainName
Parameters
- $application : ApplicationInterface
- $bootstrap : \com\setasign\SetaFramework\Bootstrap\Bootstrap
- $applicationConfig : ApplicationConfig
- $domainName : \com\setasign\SetaFramework\Bootstrap\DomainName
get()
array $params = array ( ),
?bool $singleton = null
Get an instance by class name or alias.
If singleton is false, Di will create everytime a new object.
Di will remember up to one instance of every class/alias (except $singleton is false).
If you use an alias or a class that has a configuration, $params will be merged with the params of the configuration or alias.
If the di has already an instance, the $params will be ignored because no new object is created.
Parameters
- $classNameOrAlias : string|\com\setasign\SetaFramework\Di\class-string<\com\setasign\SetaFramework\Di\T>
- $params : array
- $singleton : ?bool
Use null to use the configured value, or true/false to affect this behaviour
Exceptions
Throws \com\setasign\SetaFramework\Di\UnknownClassOrAliasException if alias wasn't found.
Throws \com\setasign\SetaFramework\Di\DiClassConstructionException if an exception occurs on constructing a new instance.
Throws \com\setasign\SetaFramework\Bootstrap\MaintenanceException
getArguments()
array $parameters
Parameters
- $reflectionParameters : array<string, \com\setasign\SetaFramework\Di\ReflectionParameter>
- $parameters : array
getByAlias()
array $params,
?bool $singleton
Get an instance by an alias
If the alias is definied to be a singleton the $params array is ignored if the instance was already created.
Parameters
- $name : string
- $params : array
- $singleton : ?bool
Use null to use the configured value, or true/false to affect this behaviour
Exceptions
Throws \com\setasign\SetaFramework\Di\UnknownClassOrAliasException if alias wasn't found.
Throws \com\setasign\SetaFramework\Di\DiClassConstructionException if an exception occurs on constructing a new instance.
Throws \com\setasign\SetaFramework\Bootstrap\MaintenanceException
getByClassName()
array $params,
?bool $singleton
Get an instance by a class name
If the class is definied to be a singleton the $params array is ignored if the instance was already created.
Parameters
- $className : \com\setasign\SetaFramework\Di\class-string<\com\setasign\SetaFramework\Di\T>
- $params : array
- $singleton : ?bool
Use null to use the configured value, or true/false to affect this behaviour
Exceptions
Throws \com\setasign\SetaFramework\Di\UnknownClassOrAliasException if alias wasn't found.
Throws \com\setasign\SetaFramework\Di\DiClassConstructionException if an exception occurs on constructing a new instance.
Throws \com\setasign\SetaFramework\Bootstrap\MaintenanceException
getDatabaseConnectionManager()
Parameters
- $bootstrap : \com\setasign\SetaFramework\Bootstrap\Bootstrap
getEventManager()
Parameters
- $bootstrap : \com\setasign\SetaFramework\Bootstrap\Bootstrap
getReflectionParameters()
Parameters
- $callable : array{0: \com\setasign\SetaFramework\Di\class-string|object, 1: string}|callable
Exceptions
Throws \ReflectionException
hasConfiguration()
Checks whether the di has a configuration for this class
Parameters
- $className : string
hasInstance()
Checks whether the di has an instance for this alias or className
Parameters
- $aliasOrClassname : string
parentInjections()
array $parameters = array ( )
Parameters
- $parentClassName : string
- $parameters : array
Exceptions
Throws \ReflectionException
prepareParams()
array $defaultParams = array ( )
Prepares inject parameters
Internally aliases will be automatically resolved.
Parameters
- $params : array
- $defaultParams : array
Exceptions
Throws \com\setasign\SetaFramework\Di\UnknownClassOrAliasException
remove()
Removes all added configurations, aliases and instances with this name.
Parameters
- $classNameOrAlias : string
setupApplicationCacheHandler()
HttpApplicationInterface $application
Parameters
- $cacheHandler : \com\setasign\SetaFramework\SimpleCache\CacheHandler
- $application : HttpApplicationInterface
setupApplicationLogHandler()
Parameters
- $logHandler : \com\setasign\SetaFramework\Log\LogHandler
- $application : HttpApplicationInterface
setupCacheHandler()
Parameters
- $bootstrap : \com\setasign\SetaFramework\Bootstrap\Bootstrap
setupLogHandler()
Parameters
- $bootstrap : \com\setasign\SetaFramework\Bootstrap\Bootstrap
