Gdn_Authenticator::getProvider PHP Method

getProvider() public method

public getProvider ( null $ProviderKey = null, boolean $Force = false ) : array | boolean | stdClass
$ProviderKey null
$Force boolean
return array | boolean | stdClass
    public function getProvider($ProviderKey = null, $Force = false)
    {
        static $AuthModel = null;
        static $Provider = null;
        if (is_null($AuthModel)) {
            $AuthModel = new Gdn_AuthenticationProviderModel();
        }
        $AuthenticationSchemeAlias = $this->getAuthenticationSchemeAlias();
        if (is_null($Provider) || $Force === true) {
            if (!is_null($ProviderKey)) {
                $ProviderData = $AuthModel->getProviderByKey($ProviderKey);
            } else {
                $ProviderData = $AuthModel->getProviderByScheme($AuthenticationSchemeAlias, Gdn::session()->UserID);
                if (!$ProviderData && Gdn::session()->UserID > 0) {
                    $ProviderData = $AuthModel->getProviderByScheme($AuthenticationSchemeAlias, null);
                }
            }
            if ($ProviderData) {
                $Provider = $ProviderData;
            } else {
                return false;
            }
        }
        return $Provider;
    }