From be126cc958212ed74fe916eabcb1e6ac928df5e4 Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Fri, 8 Oct 2010 17:43:05 +0200 Subject: tests for getadminlinkedtags --- src/SemanticScuttle/Service/User.php | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'src/SemanticScuttle') diff --git a/src/SemanticScuttle/Service/User.php b/src/SemanticScuttle/Service/User.php index d74d104..fd9d84f 100644 --- a/src/SemanticScuttle/Service/User.php +++ b/src/SemanticScuttle/Service/User.php @@ -203,18 +203,26 @@ class SemanticScuttle_Service_User extends SemanticScuttle_DbService } } - /* Takes an numerical "id" or a string "username" - and returns the numerical "id" if the user exists else returns NULL */ - function getIdFromUser($user) { + /** + * Obtains the ID of the given user name. + * If a user ID is passed, it is returned. + * In case the user does not exist, NULL is returned. + * + * @param string|integer $user User name or user ID + * + * @return integer NULL if not found or the user ID + */ + public function getIdFromUser($user) + { if (is_int($user)) { return intval($user); } else { $objectUser = $this->getObjectUserByUsername($user); - if($objectUser != NULL) { + if ($objectUser != null) { return $objectUser->getId(); } } - return NULL; + return null; } /** -- cgit v1.2.3