Code Duplication    Length = 17-17 lines in 2 locations

app/modules/Seo/Controller/RobotsController.php 1 location

@@ 25-41 (lines=17) @@
22
    {
23
        $form = new RobotsForm();
24
25
        if ($this->request->isPost()) {
26
            if ($form->isValid()) {
27
                $robots = $this->request->getPost('robots', 'string');
28
                $result = file_put_contents($this->robotsFilePath, $robots);
29
                if ($result) {
30
                    $this->flash->success('File robots.txt has been saved');
31
                    $this->redirect($this->url->get() . 'seo/robots');
32
                } else {
33
                    $this->flash->error('Error! The robots.txt file is not updated. Check the write permissions to the file.');
34
                }
35
            } else {
36
                $this->flashErrors($form);
37
            }
38
        } else {
39
            $robots = file_get_contents($this->robotsFilePath);
40
            $form->get('robots')->setDefault($robots);
41
        }
42
43
        $this->helper->title('Editing robots.txt', true);
44
        $this->view->form = $form;

app/modules/Seo/Controller/SitemapController.php 1 location

@@ 25-41 (lines=17) @@
22
    {
23
        $form = new SitemapForm();
24
25
        if ($this->request->isPost()) {
26
            if ($form->isValid()) {
27
                $sitemap = $this->request->getPost('sitemap');
28
                $result = file_put_contents($this->sitemapFilePath, $sitemap);
29
                if ($result) {
30
                    $this->flash->success('File sitemap.xml has been saved');
31
                    $this->redirect($this->url->get() . 'seo/sitemap');
32
                } else {
33
                    $this->flash->error('Error! The sitemap.xml file is not updated. Check the write permissions to the file.');
34
                }
35
            } else {
36
                $this->flashErrors($form);
37
            }
38
        } else {
39
            $sitemap = file_get_contents($this->sitemapFilePath);
40
            $form->get('sitemap')->setDefault($sitemap);
41
        }
42
43
        $title = 'Editing sitemap.xml';
44
        $this->helper->title($title);