i wonder where one can find template interfaces.
eg. i am creating these classes that implements iLog:
DatabaseLog
ScreenLog
FileLog
i wonder what methods should a typical Log class have?
is there a 开发者_如何学Pythonset of interfaces you could just implement/learn from rather than reinvent the wheel and have to think about the method names.
eg. Interfaces:
iLog
iDatabase
iErrorMessage
etc.
Thanks
PHP defines the following interfaces (should, but may not be complete):
- Traversable — The Traversable interface
- Iterator — The Iterator interface
- IteratorAggregate — The IteratorAggregate interface
- ArrayAccess — The ArrayAccess interface
- Serializable — The Serializable interface
- Countable — The Countable interface
- OuterIterator — The OuterIterator interface
- RecursiveIterator — The RecursiveIterator interface
- SeekableIterator — The SeekableIterator interface
- SplObserver — The SplObserver interface
- SplSubject — The SplSubject interface
See
- http://de.php.net/manual/en/reserved.interfaces.php
- http://de.php.net/manual/en/spl.interfaces.php
- http://de.php.net/manual/en/spl.misc.php
As for your Logger Interface, I'd say it should have a method log($message, level)
and nothing else.
精彩评论