public function __construct($host = null, $user = null, $pass = null, $dbname = null) { $this->lorem = LoremIpsumGenerator::getInstance(); if (!is_null($host)) { $this->pdo = new \PDO("mysql:host={$host};dbname={$dbname};charset=utf8", $user, $pass); if (!$this->pdo) { throw new Exception("Connection error!"); } return true; } }