Created
September 1, 2013 18:20
-
-
Save bakura10/6406265 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class CompiledFactory2 implements FactoryInterface | |
{ | |
public function createService(ServiceLocatorInterface $sl) | |
{ | |
$a = new A(); | |
$b = $sl->get('A'); | |
return new B(a); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Factory1 implements FactoryInterface | |
{ | |
public function createService(ServiceLocatorInterface $sl) | |
{ | |
$a = new A(); | |
return $a; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Factory2 implements FactoryInterface | |
{ | |
public function createService(ServiceLocatorInterface $sl) | |
{ | |
$b = $sl->get('A'); | |
return new B(a); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment