From 792e4607bafa557ff5bde3b4e4da9406cfbc3111 Mon Sep 17 00:00:00 2001 From: Florent Bruneau Date: Tue, 28 Sep 2010 14:58:07 +0200 Subject: [PATCH] Add PlUser::isMe($other): returns true if $other is a reference to the same user. Signed-off-by: Florent Bruneau --- classes/pluser.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/classes/pluser.php b/classes/pluser.php index 187f131..746ec59 100644 --- a/classes/pluser.php +++ b/classes/pluser.php @@ -146,6 +146,17 @@ abstract class PlUser implements PlUserInterface return $this->hruid; } + public function isMe($other) + { + if (!$other) { + return false; + } else if ($other instanceof PlUser) { + return $other->id() == $this->id(); + } else { + return false; + } + } + public function bestEmail() { if (!empty($this->bestalias)) { -- 2.1.4