LdapTools\Connection\LdapConnectionInterface::connect PHP Метод

connect() публичный Метод

Connect and bind to LDAP.
public connect ( string | null $username = null, string | null $password = null, boolean $anonymous = false, string | null $server = null )
$username string | null The username to connect with. If not specified, the one in the config is used.
$password string | null The password for the username.
$anonymous boolean Whether this is an attempt to bind anonymously, ignoring the username and password.
$server string | null The server to connect to. If not specified, the server(s) in the config are used.
    public function connect($username = null, $password = null, $anonymous = false, $server = null);

Usage Example

Пример #1
0
 /**
  * Do the LDAP query to get the LDAP object.
  *
  * @param bool $anonymous
  * @return \LdapTools\Object\LdapObject
  */
 protected function doLdapQuery($anonymous)
 {
     if ($anonymous) {
         $this->connection->connect('', '', true);
     }
     $schema = $this->schemaFactory->get(self::SCHEMA_ROOTDSE_NAME, $this->connection->getConfig()->getLdapType());
     return (new LdapQueryBuilder($this->connection))->from($schema)->select('*')->getLdapQuery()->getSingleResult();
 }
All Usage Examples Of LdapTools\Connection\LdapConnectionInterface::connect