public function connect()
    {
        $this->errorHandler->start();

        //create the connection
        if ($this->configuration->getSSL()) {
            $this->resource = $this->driver->sslConnect($this->configuration->getHost(), $this->configuration->getPort(), $this->configuration->getTimeout());
        } else {
            $this->resource = $this->driver->connect($this->configuration->getHost(), $this->configuration->getPort(), $this->configuration->getTimeout());
        }

        if ($this->resource !== false) {
            //log in
            if ($this->driver->login($this->resource, $this->configuration->getUser(), $this->configuration->getPass())) {
                //change directory
                if ($this->driver->pasv($this->resource, $this->configuration->getPasv())) {
                    if ($this->driver->chdir($this->resource, $this->configuration->getDir())) {
                        $this->dir = ftp_pwd($this->resource);
                        $this->errorHandler->stop();

                        return true;
                    }
                }
            }
        }
        $this->errorHandler->stop();

        return false;
    }