hostname = (string)$hostname; $this->username = (string)$username; $this->password = (string)$password; $this->database = (string)$database; $this->charset = $charset !== null ? (string)$charset : 'utf8'; $this->port = $port !== null ? (int)$port : 3306; $this->queries = $queries; } /** * @param array $config * * @return DatabaseConfig */ public static function fromArray(array $config) { return new DatabaseConfig( $config['hostname'], $config['username'], $config['password'], $config['database'], isset($config['charset']) ? $config['charset'] : null, isset($config['port']) ? $config['port'] : null, isset($config['queries']) ? $config['queries'] : [] ); } /** * @return string */ public function getHostname() { return $this->hostname; } /** * @return string */ public function getUsername() { return $this->username; } /** * @return string */ public function getPassword() { return $this->password; } /** * @return string */ public function getDatabase() { return $this->database; } /** * @return string */ public function getCharset() { return $this->charset; } /** * @return int */ public function getPort() { return $this->port; } /** * @return array */ public function getQueries() { return $this->queries; } /** * @return array */ public function __debugInfo() { return [ 'args' => [ 'hostname' => $this->hostname, 'username' => '****', 'password' => '****', 'database' => $this->database, 'charset' => $this->charset, 'port' => $this->port, 'queries' => $this->queries, ], ]; } }