Code Duplication    Length = 10-10 lines in 5 locations

Repositories/Cache/CacheMenuItemDecorator.php 5 locations

@@ 26-35 (lines=10) @@
23
     * @param  int   $menuId
24
     * @return mixed
25
     */
26
    public function rootsForMenu($menuId)
27
    {
28
        return $this->cache
29
            ->tags($this->entityName, 'global')
30
            ->remember("{$this->locale}.{$this->entityName}.rootsForMenu.{$menuId}", $this->cacheTime,
31
                function () use ($menuId) {
32
                    return $this->repository->rootsForMenu($menuId);
33
                }
34
            );
35
    }
36
37
    /**
38
     * Get the menu items ready for routes
@@ 59-68 (lines=10) @@
56
     * @param  int    $menuId
57
     * @return object
58
     */
59
    public function getRootForMenu($menuId)
60
    {
61
        return $this->cache
62
            ->tags($this->entityName, 'global')
63
            ->remember("{$this->locale}.{$this->entityName}.getRootForMenu.{$menuId}", $this->cacheTime,
64
                function () use ($menuId) {
65
                    return $this->repository->getRootForMenu($menuId);
66
                }
67
            );
68
    }
69
70
    /**
71
     * Return a complete tree for the given menu id
@@ 76-85 (lines=10) @@
73
     * @param  int    $menuId
74
     * @return object
75
     */
76
    public function getTreeForMenu($menuId)
77
    {
78
        return $this->cache
79
            ->tags($this->entityName, 'global')
80
            ->remember("{$this->locale}.{$this->entityName}.getTreeForMenu.{$menuId}", $this->cacheTime,
81
                function () use ($menuId) {
82
                    return $this->repository->getTreeForMenu($menuId);
83
                }
84
            );
85
    }
86
87
    /**
88
     * Get all root elements
@@ 93-102 (lines=10) @@
90
     * @param  int    $menuId
91
     * @return object
92
     */
93
    public function allRootsForMenu($menuId)
94
    {
95
        return $this->cache
96
            ->tags($this->entityName, 'global')
97
            ->remember("{$this->locale}.{$this->entityName}.allRootsForMenu.{$menuId}", $this->cacheTime,
98
                function () use ($menuId) {
99
                    return $this->repository->allRootsForMenu($menuId);
100
                }
101
            );
102
    }
103
104
    /**
105
     * @param  string $uri
@@ 109-118 (lines=10) @@
106
     * @param  string $locale
107
     * @return object
108
     */
109
    public function findByUriInLanguage($uri, $locale)
110
    {
111
        return $this->cache
112
            ->tags($this->entityName, 'global')
113
            ->remember("{$this->locale}.{$this->entityName}.findByUriInLanguage.{$uri}.{$locale}", $this->cacheTime,
114
                function () use ($uri, $locale) {
115
                    return $this->repository->findByUriInLanguage($uri, $locale);
116
                }
117
            );
118
    }
119
}
120