mirror of
https://gitlab.com/davical-project/davical.git
synced 2026-01-31 01:13:34 +00:00
Add __get()/__isset() so private/protected properties are read-only.
Signed-off-by: Andrew McMillan <andrew@morphoss.com>
This commit is contained in:
parent
5dbe73f709
commit
db079408d7
@ -91,7 +91,7 @@ class Principal {
|
||||
protected $by_email;
|
||||
|
||||
/**
|
||||
* If we're using memcached these is the namespace we'll put stuff in
|
||||
* If we're using memcached this is the namespace we'll put stuff in
|
||||
* @var unknown_type
|
||||
*/
|
||||
private $cacheNs;
|
||||
@ -114,6 +114,27 @@ class Principal {
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This will allow protected properties to be referenced for retrieval, but not
|
||||
* referenced for update.
|
||||
* @param $property
|
||||
*/
|
||||
function __get( $property ) {
|
||||
return $this->{$property};
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This will allow protected properties to be examined for whether they are set
|
||||
* without making them writable. PHP 5.1 or later only.
|
||||
* @param $property
|
||||
*/
|
||||
function __isset( $property ) {
|
||||
return isset($this->{$property});
|
||||
}
|
||||
|
||||
|
||||
$cache = new AwlCache();
|
||||
if ( $use_cache && isset($session->principal_id) ) {
|
||||
switch ( $type ) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user