Code Duplication    Length = 16-16 lines in 2 locations

src/Controller/Admin/AdminController.php 1 location

@@ 150-165 (lines=16) @@
147
     *
148
     * @return array
149
     */
150
    protected function _buildStats(array $array)
151
    {
152
        $statistics = [];
153
154
        foreach ($array as $type => $event) {
155
            $statistics[$type] = Cache::remember($type, function () {
156
                $this->eventManager()->attach(new Statistics());
157
                $event = new Event($event);
158
                $this->eventManager()->dispatch($event);
159
160
                return $event->result;
161
            }, 'statistics');
162
        }
163
164
        return $statistics;
165
    }
166
}
167

src/Controller/PagesController.php 1 location

@@ 101-116 (lines=16) @@
98
     *
99
     * @return array
100
     */
101
    protected function _buildStats(array $array)
102
    {
103
        $statistics = [];
104
105
        foreach ($array as $type => $event) {
106
            $statistics[$type] = Cache::remember($type, function () {
107
                $this->eventManager()->attach(new Statistics());
108
                $event = new Event($event);
109
                $this->eventManager()->dispatch($event);
110
111
                return $event->result;
112
            }, 'statistics');
113
        }
114
115
        return $statistics;
116
    }
117
118
    /**
119
     * The user accept the use of cookies.