Code Duplication    Length = 7-11 lines in 2 locations

app/modules/Cms/Model/Javascript.php 1 location

@@ 29-39 (lines=11) @@
26
        $cache->delete($key);
27
    }
28
29
    public static function findCachedById($id)
30
    {
31
        $key = HOST_HASH . md5("Javascript::getCachedScript($id)");
32
        $result = self::findFirst(array("id ='{$id}'",
33
            'cache' => array(
34
                'key' => $key,
35
                'lifetime' => 1200, //20 min
36
            )
37
        ));
38
        return $result;
39
    }
40
41
    /**
42
     * @param mixed $text

app/modules/Page/Model/Page.php 1 location

@@ 85-91 (lines=7) @@
82
        return $this->validate($validator);
83
    }
84
85
    public static function findCachedBySlug($slug)
86
    {
87
        $query = "slug = '$slug'";
88
        $key   = HOST_HASH . md5("Page::findFirst($query)");
89
        $page  = self::findFirst([$query, 'cache' => ['key' => $key, 'lifetime' => 60]]);
90
        return $page;
91
    }
92
93
    /**
94
     * @param mixed $created_at