< 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:12
Uncovered lines:8
Coverable lines:20
Total lines:48
Line coverage:60% (12 of 20)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
GetInt(...)0%2100%
GetInt(...)0%2100%
GetBool(...)0%330100%
SetBool(...)0%330100%
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
 09        public static int GetInt(string key, int defaultValue) { return PlayerPrefs.GetInt(key, defaultValue); }
 10
 576011        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        {
 915            PlayerPrefs.SetInt(key, value ? 1 : 0);
 916        }
 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
 192030        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            {
 1938                PlayerPrefs.SetString(key, value);
 1939            }
 040            catch (PlayerPrefsException e)
 41            {
 042                Debug.Log("There was an issue setting PlayerPrefs string!");
 043            }
 1944        }
 45
 7246        public static void Save() { PlayerPrefs.Save(); }
 47    }
 48}