Code Duplication    Length = 10-10 lines in 2 locations

src/Controller/Admin/ArticlesController.php 1 location

@@ 116-125 (lines=10) @@
113
            return $this->redirect(['action' => 'index']);
114
        }
115
116
        if ($this->request->is('put')) {
117
            $this->BlogArticles->patchEntity($article, $this->request->getParsedBody());
118
            $article->setTranslations($this->request->getParsedBody());
119
120
            if ($this->BlogArticles->save($article)) {
121
                $this->Flash->success(__d('admin', 'This article has been updated successfully !'));
122
123
                return $this->redirect(['action' => 'index']);
124
            }
125
        }
126
127
        $categories = $this->BlogArticles->BlogCategories->find('list');
128
        $this->set(compact('article', 'categories'));

src/Controller/Admin/CategoriesController.php 1 location

@@ 82-91 (lines=10) @@
79
            return $this->redirect(['action' => 'index']);
80
        }
81
82
        if ($this->request->is('put')) {
83
            $this->BlogCategories->patchEntity($category, $this->request->getParsedBody());
84
            $category->setTranslations($this->request->getParsedBody());
85
86
            if ($this->BlogCategories->save($category)) {
87
                $this->Flash->success(__d('admin', 'This category has been updated successfully !'));
88
89
                return $this->redirect(['action' => 'index']);
90
            }
91
        }
92
93
        $this->set(compact('category'));
94
    }