public function connect($ldapUrl)
    {
        // Make sure the connection has been established successfully
        if (! $this->resource = @ldap_connect($ldapUrl)) {
            throw new \Exception(sprintf("Unable to connect to ldap server %s", $ldapUrl));
        }

        // Set sane defaults for ldap v3 protocol
        $this->setOption(LDAP_OPT_PROTOCOL_VERSION, 3)
             ->setOption(LDAP_OPT_REFERRALS, 0);

        return $this;
    }
public function connect($ldapUrl)
    {
        // Make sure the connection has been established successfully
        if (! $this->resource = @ldap_connect($ldapUrl)) {
            throw new \Exception(sprintf("Unable to connect to ldap server %s", $ldapUrl));
        }

        // Set sane defaults for ldap v3 protocol
        $this->setOption(LDAP_OPT_PROTOCOL_VERSION, 3)
             ->setOption(LDAP_OPT_REFERRALS, 0);

        return $this;
    }
public function connect ( $ ldapUrl ) { // Make sure the connection has been established successfully if ( ! $ this -> resource = @ ldap_connect ( $ ldapUrl ) ) { throw new \ Exception ( sprintf ( "Unable to connect to ldap server %s" , $ ldapUrl ) ) ; } // Set sane defaults for ldap v3 protocol $ this -> setOption ( LDAP_OPT_PROTOCOL_VERSION , 3 ) -> setOption ( LDAP_OPT_REFERRALS , 0 ) ; return $ this ; }
Open connection to an ldap server

@param  string       $ldapUrl    Ldap URI string of the ldap server (i.e.
ldap://my.server.com:389)
@return self
@throws \Exception               On connect error.
Open connection to an ldap server