mirror of
https://github.com/DesignPatternsPHP/DesignPatternsPHP.git
synced 2025-06-10 07:54:56 +02:00
add comments about null logger
This commit is contained in:
parent
397e18da8b
commit
f157729ea4
@ -8,6 +8,8 @@ namespace DesignPatterns\NullObject;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* LoggerInterface is a contract for logging something
|
* LoggerInterface is a contract for logging something
|
||||||
|
*
|
||||||
|
* Key-feaature : NullLogger MUST inherit from this interface like any other Loggers
|
||||||
*/
|
*/
|
||||||
interface LoggerInterface
|
interface LoggerInterface
|
||||||
{
|
{
|
||||||
|
@ -26,13 +26,16 @@ namespace DesignPatterns\NullObject;
|
|||||||
*
|
*
|
||||||
* Performance concerns : ok there is a call for nothing but we spare an "if is_null"
|
* Performance concerns : ok there is a call for nothing but we spare an "if is_null"
|
||||||
* I didn't run a benchmark but I think it's equivalent.
|
* I didn't run a benchmark but I think it's equivalent.
|
||||||
|
*
|
||||||
|
* Key feature : of course this logger MUST implement the same interface (or abstract)
|
||||||
|
* like the other loggers.
|
||||||
*/
|
*/
|
||||||
class NullLogger implements LoggerInterface
|
class NullLogger implements LoggerInterface
|
||||||
{
|
{
|
||||||
|
|
||||||
public function log($str)
|
public function log($str)
|
||||||
{
|
{
|
||||||
|
// do nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user