Skip to content

Commit

Permalink
Merge aefe6aa into 6894150
Browse files Browse the repository at this point in the history
  • Loading branch information
Trismegiste committed Sep 8, 2013
2 parents 6894150 + aefe6aa commit dca87ad
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
Expand Up @@ -23,11 +23,14 @@ class Adapter implements TargetInterface

/**
* The constructor.
*
* To achieve Dependency Inversion Principle, we need to inject adaptee(s)
* in the constructor of adapter. This is a key feature.
*/
public function __construct()
public function __construct(AdapteeA $a, AdapteeB $b)
{
$this->adapteeA = new AdapteeA();
$this->adapteeB = new AdapteeB();
$this->adapteeA = $a;
$this->adapteeB = $b;
}

/**
Expand Down
Expand Up @@ -5,5 +5,5 @@

require '../../../../../../../vendor/autoload.php';

$adapter = new Adapter();
$adapter = new Adapter(new AdapteeA(), new AdapteeB());
$adapter->targetMethod();

0 comments on commit dca87ad

Please sign in to comment.