Code Duplication    Length = 3-4 lines in 2 locations

AdminModule/presenters/HomepagePresenter.php 2 locations

@@ 118-120 (lines=3) @@
115
116
    public function actionDeleteExceptionLog($id)
117
    {
118
        foreach (Finder::findFiles('exception-*' . $id . '.html')->in(APP_DIR . '/../log') as $key => $file) {
119
            $filename = $file->getFileName();
120
        }
121
122
        if (!empty($filename)) {
123
            unlink(APP_DIR . '/../log/' . $filename);
@@ 135-138 (lines=4) @@
132
    public function actionDeleteAllExceptionLogs()
133
    {
134
        if ($this->getUser()->getRoles()[0] === 'superadmin') {
135
            foreach (Finder::findFiles('exception-*.html')->in(APP_DIR . '/../log') as $key => $file) {
136
                $filename = $file->getFileName();
137
                unlink(APP_DIR . '/../log/' . $filename);
138
            }
139
        }
140
        $this->flashMessage('All exception logs have been deleted.', 'success');
141
        $this->forward('default');