Last active
April 16, 2017 03:13
-
-
Save pedrogk/b7ff45b3f3c3cab0f919f58f2022b964 to your computer and use it in GitHub Desktop.
Inyección de dependencia via constructor
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 | |
class MyClass { | |
private $logger; | |
public function __construct(LoggerInterface $logger) { | |
$this->logger = $logger; | |
} | |
public function send($message) { | |
return $this->logger->info($message); | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment