for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Bone\Db\Adapter;
use Bone\Db\Adapter\DbAdapterInterface;
use PDO;
/**
* Class AbstractDbAdapter
* @package Bone\Db\Adapter
*/
abstract class AbstractDbAdapter implements DbAdapterInterface
{
* @var PDO $connection
protected $connection;
* @var string
private $host;
private $database;
private $user;
/** @var string $pass */
private $pass;
* @param $credentials
public function __construct($credentials)
$this->host = $credentials['host'];
$this->database = $credentials['database'];
$this->user = $credentials['user'];
$this->pass = $credentials['pass'];
}
* @return mixed
abstract public function openConnection();
abstract public function closeConnection();
* @return bool
public function isConnected()
if(!$this->connection)
return false;
return true;
* @param $sql
* @return mixed|null
public function executeQuery($sql)
// @todo: Implement executeQuery() method.
return null;
* @return PDO
public function getConnection()
if(!$this->isConnected())
$this->openConnection();
return $this->connection;
* @return string|null
protected function getDatabase()
return $this->database;
protected function getHost()
return $this->host;
protected function getPass()
return $this->pass;
protected function getUser()
return $this->user;