Created
April 5, 2016 17:35
-
-
Save willianmano/62b8662cfcba137631647140a47e5c93 to your computer and use it in GitHub Desktop.
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 | |
require_once('vendor/autoload.php'); | |
use Logger\LoggerLaravel; | |
$logger = new LoggerLaravel(); | |
if($logger instanceof \Logger\LoggerAbstract) { | |
echo 'eh instanceof \Logger\LoggerAbstract<br>'; | |
} | |
if($logger instanceof \Logger\LoggerInterface) { | |
echo 'eh instanceof \Logger\LoggerInterface'; | |
} |
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 | |
namespace Logger; | |
abstract class LoggerAbstract implements LoggerInterface { | |
protected $prefix = ""; | |
protected function getStrToLog($str) { | |
return $this->prefix . " - " . $str; | |
} | |
public function setPrefix($prefix) { | |
$this->prefix = $prefix; | |
} | |
} |
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 | |
namespace Logger; | |
interface LoggerInterface { | |
public function alert($error, $contextInfo = []); | |
} |
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 | |
namespace Logger; | |
class LoggerLaravel extends LoggerAbstract { | |
public function alert($error, $contextInfo = []) { | |
echo 'Alert... error...'; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment