mirror of
https://github.com/DesignPatternsPHP/DesignPatternsPHP.git
synced 2025-07-30 19:50:12 +02:00
Update DependenyInjection/DependencyInjection.php
This commit is contained in:
@@ -6,14 +6,14 @@ namespace DesignPatterns;
|
|||||||
* Dependency Injection
|
* Dependency Injection
|
||||||
*
|
*
|
||||||
* Purpose:
|
* Purpose:
|
||||||
* to implement a loosely coupled architecture in order to get better testable, maintainable and extandable code
|
* to implement a loosely coupled architecture in order to get better testable, maintainable and extendable code
|
||||||
*
|
*
|
||||||
* Examples:
|
* Examples:
|
||||||
* - the Doctrine2 ORM uses dependency injection e.g. for Configuration that is injected into a Connection object. for
|
* - the Doctrine2 ORM uses dependency injection e.g. for Configuration that is injected into a Connection object. for
|
||||||
* testing purposes, one can easily create a mock object of the configuration and inject that into the connection
|
* testing purposes, one can easily create a mock object of the configuration and inject that into the connection
|
||||||
* object
|
* object
|
||||||
* - Symfony and Zend Framework 2 already have containers for DI that create objects via a configuration array and
|
* - Symfony and Zend Framework 2 already have containers for DI that create objects via a configuration array and
|
||||||
* inject them where needed
|
* inject them where needed (i.e. in Controllers)
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
class Configuration
|
class Configuration
|
||||||
@@ -60,4 +60,4 @@ class Connection
|
|||||||
$host = $this->_configuration->getHost();
|
$host = $this->_configuration->getHost();
|
||||||
// ...
|
// ...
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user