public function connect()
    {
        $this->connect = ldap_connect($this->hostname, $this->port);

        if (!$this->connect) {
            throw new ConnectionException($this);
        }

        // Set Ldap Version to 3
        ldap_set_option($this->connect, LDAP_OPT_PROTOCOL_VERSION, 3);

        if (!is_null($this->username) && !is_null($this->password)) {
            if (!@ldap_bind($this->connect, $this->username, $this->password)) {
                throw new BadIdentificationException($this);
            }
        }

        return new Client($this->connect);
    }
public function connect()
    {
        $this->connect = ldap_connect($this->hostname, $this->port);

        if (!$this->connect) {
            throw new ConnectionException($this);
        }

        // Set Ldap Version to 3
        ldap_set_option($this->connect, LDAP_OPT_PROTOCOL_VERSION, 3);

        if (!is_null($this->username) && !is_null($this->password)) {
            if (!@ldap_bind($this->connect, $this->username, $this->password)) {
                throw new BadIdentificationException($this);
            }
        }

        return new Client($this->connect);
    }
public function connect ( ) { $ this -> connect = ldap_connect ( $ this -> hostname , $ this -> port ) ; if ( ! $ this -> connect ) { throw new ConnectionException ( $ this ) ; } // Set Ldap Version to 3 ldap_set_option ( $ this -> connect , LDAP_OPT_PROTOCOL_VERSION , 3 ) ; if ( ! is_null ( $ this -> username ) && ! is_null ( $ this -> password ) ) { if ( ! @ ldap_bind ( $ this -> connect , $ this -> username , $ this -> password ) ) { throw new BadIdentificationException ( $ this ) ; } } return new Client ( $ this -> connect ) ; }
Connect to the Ldap Server and get a client to execute Query

@return Client
@throws \OpenLdapObject\Exception\ConnectionException
@throws \OpenLdapObject\Exception\BadIdentificationException
Connect to the Ldap Server and get a client to execute Query