Created
January 24, 2013 11:21
-
-
Save AmyStephen/4620244 to your computer and use it in GitHub Desktop.
PSR-3 Static Factory Approach
This file contains hidden or 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 | |
use Psr\Log\LoggerInterface; | |
class Foo | |
{ | |
private $logger; | |
public function __construct() | |
{ | |
$this->logger = MyStaticFactory::getLog(); | |
} | |
public function doSomething() | |
{ | |
if ($this->logger) { | |
$this->logger->info('Doing work'); | |
} | |
// do something useful | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment