PHP Design Pattern

Creative Handz

New Member
I have a class that performs database operations and returns results (array, true, false). And I have an another class that creates JSON string by using this class in its constructor.Can we say this class is an Adapter? Or simply wrapper or ...\[code\]Class Db{ public function getRows($params) { //... }}Class DbAdapter{ private $_dbh; public function __construct($dbh) { $this->_dbh = $dbh; } public function getJson() { return '{"key": "foo", "key2": ' . json_encode($this->_dbh->getRows($params)) . '}'; }}\[/code\]Thanks
 
Back
Top