Code Duplication    Length = 17-18 lines in 2 locations

src/Distilleries/Contentful/Models/Locale.php 2 locations

@@ 54-71 (lines=18) @@
51
     *
52
     * @return string
53
     */
54
    public static function default(): string
55
    {
56
        $default = Cache::get('locale_default');
57
58
        if ($default === null)
59
        {
60
            $default = static::query()
61
                ->select('locale')
62
                ->where('is_default', '=', true)
63
                ->first();
64
65
            $default = !empty($default) ? $default->locale : config('contentful.default_locale');
66
            // Cache is cleaned in Console\Commands\SyncLocales (run at least daily)
67
            Cache::forever('locale_default', $default);
68
        }
69
70
        return $default;
71
    }
72
73
74
    public static function getAppOrDefaultLocale(): string
@@ 89-105 (lines=17) @@
86
     *
87
     * @return string
88
     */
89
    public static function defaultCountry(): string
90
    {
91
        $default = Cache::get('country_default');
92
93
        if ($default === null)
94
        {
95
            $default = static::query()
96
                ->select('country')
97
                ->where('is_default', '=', true)
98
                ->first();
99
            $default = !empty($default) ? $default->country : config('contentful.default_country');
100
            // Cache is cleaned in Console\Commands\SyncLocales (run at least daily)
101
            Cache::forever('country_default', $default);
102
        }
103
104
        return $default;
105
    }
106
107
    /**
108
     * Return fallback code for given locale code.