database = (string)$database; $this->username = (string)$username; $this->password = (string)$password; $this->host = $this->socket = (string)$host; $this->port = (int)$port; $this->charset = (string)$charset; } /** * @return PDO|mysqli */ public function __invoke() { return $this->handler; } /** * */ protected function socketHandler() { if (strpos($this->socket, ':') === false) { $this->host = $this->socket; return; } $data = explode(':', $this->socket); $this->host = $data[0]; if (isset($data[1]) && (int)$data[1]) { $this->port = $data[1]; } } }