< Summary

Class:DCL.Helpers.PlayerPrefsUtils
Assembly:Utils
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Helpers/Utils/PlayerPrefsUtils.cs
Covered lines:11
Uncovered lines:9
Coverable lines:20
Total lines:48
Line coverage:55% (11 of 20)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
GetInt(...)0%2100%
GetInt(...)0%110100%
GetBool(...)0%330100%
SetBool(...)0%12300%
SetInt(...)0%1.121050%
HasKey(...)0%110100%
GetString(...)0%330100%
SetString(...)0%1.121050%
Save()0%110100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Helpers/Utils/PlayerPrefsUtils.cs

#LineLine coverage
 1using UnityEngine;
 2
 3namespace DCL.Helpers
 4{
 5    public static class PlayerPrefsUtils
 6    {
 07        public static int GetInt(string key) { return PlayerPrefs.GetInt(key); }
 8
 1269        public static int GetInt(string key, int defaultValue) { return PlayerPrefs.GetInt(key, defaultValue); }
 10
 911        public static bool GetBool(string key, bool defaultValue) => PlayerPrefs.GetInt(key, defaultValue ? 1 : 0) == 1;
 12
 13        public static void SetBool(string key, bool value)
 14        {
 015            PlayerPrefs.SetInt(key, value ? 1 : 0);
 016        }
 17
 18        public static void SetInt(string key, int value)
 19        {
 20            try
 21            {
 1822                PlayerPrefs.SetInt(key, value);
 1823            }
 024            catch (PlayerPrefsException e)
 25            {
 026                Debug.Log("There was an issue setting PlayerPrefs int!");
 027            }
 1828        }
 29
 330        public static bool HasKey(string key) { return PlayerPrefs.HasKey(key); }
 31
 1032        public static string GetString(string key, string defaultValue = null) { return PlayerPrefs.GetString(key, strin
 33
 34        public static void SetString(string key, string value)
 35        {
 36            try
 37            {
 2038                PlayerPrefs.SetString(key, value);
 2039            }
 040            catch (PlayerPrefsException e)
 41            {
 042                Debug.Log("There was an issue setting PlayerPrefs string!");
 043            }
 2044        }
 45
 7246        public static void Save() { PlayerPrefs.Save(); }
 47    }
 48}