/** * You can create your own Users Plugin to override this class. * Example of how you would overwrite the UsersManager_API with your own class: * Call the following in your plugin __construct() for example: * * Registry::set('UsersManager_API',Piwik_MyCustomUsersManager_API::getInstance()); * * @throws Exception * @return \Piwik\Plugins\UsersManager\API */ public static function getInstance() { try { $instance = \Piwik\Registry::get('UsersManager_API'); if (!$instance instanceof API) { // Exception is caught below and corrected throw new Exception('UsersManager_API must inherit API'); } self::$instance = $instance; } catch (Exception $e) { self::$instance = new self(); \Piwik\Registry::set('UsersManager_API', self::$instance); } return self::$instance; }
/** * You can create your own Users Plugin to override this class. * Example of how you would overwrite the UsersManager_API with your own class: * Call the following in your plugin __construct() for example: * * StaticContainer::getContainer()->set('UsersManager_API', \Piwik\Plugins\MyCustomUsersManager\API::getInstance()); * * @throws Exception * @return \Piwik\Plugins\UsersManager\API */ public static function getInstance() { try { $instance = StaticContainer::get('UsersManager_API'); if (!$instance instanceof API) { // Exception is caught below and corrected throw new Exception('UsersManager_API must inherit API'); } self::$instance = $instance; } catch (Exception $e) { self::$instance = StaticContainer::get('Piwik\\Plugins\\UsersManager\\API'); StaticContainer::getContainer()->set('UsersManager_API', self::$instance); } return self::$instance; }