@param Userinfo $userinfo

@return bool
357682
public static function validateUser($userinfo)
	{
		$plugins = Factory::getPlugins();

		foreach($plugins as $plugin) {
			$user = Factory::getUser($plugin->name);
			if (!$user->validateUser($userinfo)) {
				throw new \RuntimeException('unknown validation: ' . $plugin->name);
			}
		}
		return true;
	}
697432
public function checkUserFollowsAnother(string $username, string $targetUser): bool
    {
        $this->getApi()->request($this->getApi()
                                      ->sprintf('/users/:username/following/:target_user', $username, $targetUser));

        if ($this->getApi()->getHeaders()['Status'] == '204 No Content') {
            return true;
        }

        return false;
    }
969799
public function hasParticipant($userId)
    {
        $participants = $this->participants()->where('user_id', '=', $userId);
        if ($participants->count() > 0) {
            return true;
        }

        return false;
    }
293534
public function isExistsAmongTwoUsers($user1, $user2)
    {
        $conversation = Conversation::where(
            function ($query) use ($user1, $user2) {
                $query->where(
                    function ($q) use ($user1, $user2) {
                        $q->where('user_one', $user1)
                            ->where('user_two', $user2);
                    }
                )
                    ->orWhere(
                        function ($q) use ($user1, $user2) {
                            $q->where('user_one', $user2)
                                ->where('user_two', $user1);
                        }
                    );
            }
        );

        if ($conversation->exists()) {
            return $conversation->first()->id;
        }

        return false;
    }
727845
public function hasGuide(User $user)
    {
        $isGuide = false;

        foreach ($this->getPortfolioGuides() as $portfolioGuide) {
            if ($user->getId() === $portfolioGuide->getUser()->getId()) {
                $isGuide = true;
                break;
            }
        }

        return $isGuide;
    }
438730
public static function delete_data_for_users(approved_userlist $userlist) {

        $context = $userlist->get_context();

        if ($context instanceof \context_user) {
            static::delete_user_data($context->instanceid, $context);
        }
    }
925020
final public function updateLookup(Userinfo $userinfo, Userinfo $exsistinginfo)
	{
		$jname = $this->getJname();
		if ($userinfo->getJname() == $jname) {
			$db = Factory::getDBO();
			//we don't need to update the lookup for internal joomla unless deleting a user

			try {
				$query = $db->getQuery(true)
					->select('*')
					->from('#__jfusion_users')
					->where('( userid = ' . $db->quote($exsistinginfo->userid) . ' AND ' . 'jname = ' . $db->quote($exsistinginfo->getJname()) . ' )', 'OR')
					->where('( email = ' . $db->quote($userinfo->email) . ' AND ' . 'jname = ' . $db->quote($exsistinginfo->getJname()) . ' )', 'OR');
				if ($jname != $exsistinginfo->getJname()) {
					$query->where('( userid = ' . $db->quote($userinfo->userid) . ' AND ' . 'jname = ' . $db->quote($jname) . ' )', 'OR')
						->where('( email = ' . $db->quote($userinfo->email) . ' AND ' . 'jname = ' . $db->quote($jname) . ' )', 'OR');
				}
				$db->setQuery($query);

				$list = $db->loadObjectList('jname');
				if (empty($list)) {
					$first = new stdClass();
					$first->id = -1;
					$first->username = $exsistinginfo->username;
					$first->userid = $exsistinginfo->userid;
					$first->email = $exsistinginfo->email;
					$first->jname = $exsistinginfo->getJname();
					$db->insertObject('#__jfusion_users', $first, 'autoid');

					$first->id = $first->autoid;
					$db->updateObject('#__jfusion_users', $first, 'autoid');
					if ($jname != $exsistinginfo->getJname()) {
						$second = new stdClass();
						$second->id = $first->id;
						$second->username = $userinfo->username;
						$second->userid = $userinfo->userid;
						$second->email = $userinfo->email;
						$second->jname = $jname;
						$db->insertObject('#__jfusion_users', $second);
					}
				} else if (!isset($list[$exsistinginfo->getJname()])) {
					$first = new stdClass();
					$first->id = $list[$jname]->id;
					$first->username = $exsistinginfo->username;
					$first->userid = $exsistinginfo->userid;
					$first->email = $exsistinginfo->email;
					$first->jname = $exsistinginfo->getJname();
					$db->insertObject('#__jfusion_users', $first, 'autoid');
				} else if (!isset($list[$jname])) {
					$first = new stdClass();
					$first->id = $list[$exsistinginfo->getJname()]->id;
					$first->username = $userinfo->username;
					$first->userid = $userinfo->userid;
					$first->userid = $userinfo->userid;
					$first->jname = $jname;
					$db->insertObject('#__jfusion_users', $first, 'autoid');
				} else {
					$first = $list[$jname];
					$first->username = $userinfo->username;
					$first->userid = $userinfo->userid;
					$first->email = $userinfo->email;
					$db->updateObject('#__jfusion_users', $first, 'autoid');
				}
				return true;
			} catch (Exception $e) {
				echo $e->getMessage();
				Framework::raise(LogLevel::ERROR, $e);
			}
		}
		return false;
	}
984294
protected function setUserInfo($user, $password = null)
    {
        $this->userInfo = $user . ((null !== $password) ? (':' . $password) : '');
    }
769355
protected function isValidUserParameter(string $user_parameter): bool
    {
        $validUserParameters = array(
            'id',
            'user_login',
            'display_name',
            'user_email',
            'user_registered',
            'roles',
            'user_nicename',
            'user_url',
            'user_activation_key',
            'user_status',
            'url'
        );
        return in_array(strtolower($user_parameter), $validUserParameters, true);
    }
593639
private static function isValidAuthUser(?string $userinfo): bool
    {
        if ($userinfo === null) {
            return true;
        }

        // http://tools.ietf.org/html/rfc3986#section-3.2.1
        // userinfo = *( unreserved / pct-encoded / sub-delims / ":" )
        $pattern = sprintf(
            '/\A(?:[%s%s:]|(?:%s))*\z/i',
            'a-z0-9\-._~',
            '!$&\'()*+,;=',
            '%[a-f0-9]{2}'
        );

        return !!preg_match($pattern, $userinfo);
    }
484029
public static function delete_data_for_users(approved_userlist $userlist) {
        $context = $userlist->get_context();

        if ($context instanceof \context_user) {
            static::delete_data($context->instanceid);
        }
    }
366085
protected static function normalizeUserInfo(?string $userInfo): ?string
    {
        if ($userInfo === null) {
            return null;
        }

        if (!static::isValidUserInfo($userInfo)) {
            $message = sprintf('Invalid user info: %s', $userInfo);
            throw new DomainException($message);
        }

        return static::encodeUserInfo(static::decode($userInfo, static::UNRESERVED_SET));
    }
383115
public function validate(array $tokenInfo) : bool {
    $token = isset($tokenInfo['token']) ? $tokenInfo['token'] : '';
    return ($this->token === $token);
  }
955840
public function getUserInfo()
    {
        if (!isset($this->userinfo)) {
            $this->userinfo = $this->request('GET', 'userInfo');
        }

        return $this->userinfo;
    }
303185
public function hasLabelOfNameAndUserId(string $labelName, string $userId): bool
    {
        /* @var GmailLabelInterface $label */
        if ($this->getLabelOfNameAndUserId($labelName, $userId) instanceof GmailLabelInterface) {
            return true;
        }

        return false;
    }
133733
public function matchContentInfo(ContentInfo $contentInfo)
    {
        $location = $this->repository->sudo(
            function (Repository $repository) use ($contentInfo) {
                return $repository->getLocationService()->loadLocation($contentInfo->mainLocationId);
            }
        );

        return isset($this->values[$location->parentLocationId]);
    }
1263487
public function matchContentInfo(ContentInfo $contentInfo)
    {
        $section = $this->repository->sudo(
            function (Repository $repository) use ($contentInfo) {
                return $repository->getSectionService()->loadSection(
                    $contentInfo->sectionId
                );
            }
        );

        return isset($this->values[$section->identifier]);
    }