src/user.php
public static function find($usernameOrId, string $password = "") {
		self::check();
		if (is_numeric($usernameOrId)) {
			$bean = R::load('user', $usernameOrId);
		}
		else {
			$userdbname = setup::getValidation("username");
			if ($password != "") {
				$pwdbname = setup::getValidation("password");
				$bean     = R::findOne('user', ' ' . $userdbname . ' = ? AND ' . $pwdbname . ' = ? ', [
					$usernameOrId,
					setup::doHash($password)
				]);
			}
			else {
				$bean = R::findOne('user', ' ' . $userdbname . ' = ? ', [$usernameOrId]);
			}
		}
		if (!is_null($bean)) {
			return new self("", $bean);
		}

		return false;
	}
public static function find($usernameOrId, string $password = "") {
		self::check();
		if (is_numeric($usernameOrId)) {
			$bean = R::load('user', $usernameOrId);
		}
		else {
			$userdbname = setup::getValidation("username");
			if ($password != "") {
				$pwdbname = setup::getValidation("password");
				$bean     = R::findOne('user', ' ' . $userdbname . ' = ? AND ' . $pwdbname . ' = ? ', [
					$usernameOrId,
					setup::doHash($password)
				]);
			}
			else {
				$bean = R::findOne('user', ' ' . $userdbname . ' = ? ', [$usernameOrId]);
			}
		}
		if (!is_null($bean)) {
			return new self("", $bean);
		}

		return false;
	}
public static function find ( $ usernameOrId , string $ password = "" ) { self :: check ( ) ; if ( is_numeric ( $ usernameOrId ) ) { $ bean = R :: load ( 'user' , $ usernameOrId ) ; } else { $ userdbname = setup :: getValidation ( "username" ) ; if ( $ password != "" ) { $ pwdbname = setup :: getValidation ( "password" ) ; $ bean = R :: findOne ( 'user' , ' ' . $ userdbname . ' = ? AND ' . $ pwdbname . ' = ? ' , [ $ usernameOrId , setup :: doHash ( $ password ) ] ) ; } else { $ bean = R :: findOne ( 'user' , ' ' . $ userdbname . ' = ? ' , [ $ usernameOrId ] ) ; } } if ( ! is_null ( $ bean ) ) { return new self ( "" , $ bean ) ; } return false ; }
find a user

@param string|int $usernameOrId
@param string     $password

@return bool|\common\user\user
find a user