Category: disco

Disco with Design Patterns: A Fresh Look at Dependency Injection

Dependency Injection is all about code reusability. It’s a design pattern aiming to make high-level code reusable, by separating the object creation / configuration from usage.Consider the following code: <?phpclass Test {protected $dbh;public function __construct(PDO $dbh) { ...