public function exec()
    {
        $dsn = "mysql:host=%s;port=%s";

        try {
            $this->connection = new \PDO(
                sprintf($dsn, $this->host, $this->port),
                $this->user,
                $this->password
            );
        } catch (\PDOException $e) {
            $this->validationMessages = 'Wrong connection information';

            $this->isValid = false;
        }

        return $this->isValid;
    }
public function exec()
    {
        $dsn = "mysql:host=%s;port=%s";

        try {
            $this->connection = new \PDO(
                sprintf($dsn, $this->host, $this->port),
                $this->user,
                $this->password
            );
        } catch (\PDOException $e) {
            $this->validationMessages = 'Wrong connection information';

            $this->isValid = false;
        }

        return $this->isValid;
    }
public function exec ( ) { $ dsn = "mysql:host=%s;port=%s" ; try { $ this -> connection = new \ PDO ( sprintf ( $ dsn , $ this -> host , $ this -> port ) , $ this -> user , $ this -> password ) ; } catch ( \ PDOException $ e ) { $ this -> validationMessages = 'Wrong connection information' ; $ this -> isValid = false ; } return $ this -> isValid ; }
Perform database connection check

@return bool
Perform database connection check