public function SimpleLdapRole::__get in Simple LDAP 7.2
Same name and namespace in other branches
- 7 simple_ldap_role/SimpleLdapRole.class.php \SimpleLdapRole::__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
- simple_ldap_role/
SimpleLdapRole.class.php, line 76 - SimpleLdapRole class file.
Class
- SimpleLdapRole
- @file SimpleLdapRole class file.
Code
public function __get($name) {
switch ($name) {
case 'attributes':
case 'dn':
case 'exists':
case 'server':
return $this->{$name};
default:
if (isset($this->attributes[$name])) {
// Make sure 'count' is set accurately.
if (!isset($this->attributes[$name]['count'])) {
$this->attributes[$name]['count'] = count($this->attributes[$name]);
}
else {
$this->attributes[$name]['count'] = count($this->attributes[$name]) - 1;
}
return $this->attributes[$name];
}
return array(
'count' => 0,
);
}
}