/** * Creates instance of OAuth2 server object * * @return RApiOauth2Oauth2 */ public static function getOAuth2Server() { if (RBootstrap::getConfig('enable_oauth2_server', 0) == 0) { return null; } if (!isset(self::$serverApi)) { $options = array('api' => 'oauth2'); self::$serverApi = RApi::getInstance($options); } return self::$serverApi; }