public function SimpleLdapServer::__get in Simple LDAP 7.2
Same name and namespace in other branches
- 7 SimpleLdapServer.class.php \SimpleLdapServer::__get()
Magic __get() function.
Parameters
string $name: Name of the variable to get.
Return value
mixed Returns the value of the requested variable, if allowed.
File
- ./
SimpleLdapServer.class.php, line 133 - Class to handle LDAP server connections and related operations.
Class
- SimpleLdapServer
- Simple LDAP server class.
Code
public function __get($name) {
switch ($name) {
case 'rootdse':
// Load the rootDSE.
$this
->rootdse();
break;
case 'basedn':
// Load the baseDN.
$this
->basedn();
break;
case 'type':
// Determine the directory type.
$this
->type();
break;
case 'schema':
case 'subschema':
// Load the schema.
$this
->schema();
return $this->schema;
case 'error':
return ldap_errno($this->resource);
// Handle PHP ldap options.
case 'LDAP_OPT_DEREF':
case 'LDAP_OPT_SIZELIMIT':
case 'LDAP_OPT_TIMELIMIT':
case 'LDAP_OPT_NETWORK_TIMEOUT':
case 'LDAP_OPT_PROTOCOL_VERSION':
case 'LDAP_OPT_ERROR_NUMBER':
case 'LDAP_OPT_REFERRALS':
case 'LDAP_OPT_RESTART':
case 'LDAP_OPT_HOST_NAME':
case 'LDAP_OPT_ERROR_STRING':
case 'LDAP_OPT_MATCHED_DN':
case 'LDAP_OPT_SERVER_CONTROLS':
case 'LDAP_OPT_CLIENT_CONTROLS':
$this
->connect();
$result = SimpleLdap::ldap_get_option($this->resource, constant($name), $value);
if ($result !== FALSE) {
return $value;
}
return FALSE;
}
return $this->{$name};
}