Хабр Курсы для всех
РЕКЛАМА
Практикум, Хекслет, SkyPro, авторские курсы — собрали всех и попросили скидки. Осталось выбрать!
interface AlbumDbMapperInterface
{
public function getAlbums()
public function getAlbum($id)
}
interface ArtistDbMapperInterface
{
public function getArtists()
public function getArtist($id)
}
interface TagMongoDbMapperInterface
{
public function getTags()
}
class AlbumDbMapper implements AlbumDbMapperInterface
{
public function getAlbums(){}
public function getAlbum($id){}
}
class ArtistDbMapper implements ArtistDbMapperInterface
{
public function getArtists(){}
public function getArtist($id){}
}
class TagMongoDbMapper implements TagMongoDbMapperInterface
{
public function getTags(){}
}
abstract class CachingDecorator{}
class AlbumDbMapperCachingDecorator extends CachingDecorator implements AlbumDbMapperInterface
{
public function getAlbums(){}
public function getAlbum($id){}
}
class ArtistDbMapperCachingDecorator extends CachingDecorator implements ArtistDbMapperInterface
{
public function getArtists(){}
public function getArtist($id){}
}
class TagMongoDbMapperCachingDecorator extends CachingDecorator implements TagMongoDbMapperInterface
{
public function getTags(){}
}
function doSomething(MyDBClass $db) { ... }
class CachingDecorator implements MyDBInterface {}function doSomething(MyDBInterface $db) { ... }
Волшебный кэширующий декоратор