| Conditions | 4 |
| Paths | 4 |
| Total Lines | 27 |
| Lines | 17 |
| Ratio | 62.96 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 21 | public function indexAction() |
||
| 22 | { |
||
| 23 | $form = new SitemapForm(); |
||
| 24 | |||
| 25 | View Code Duplication | 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); |
||
| 45 | $this->view->title = $title; |
||
| 46 | $this->view->form = $form; |
||
| 47 | } |
||
| 48 | |||
| 50 |
If you access a property on an interface, you most likely code against a concrete implementation of the interface.
Available Fixes
Adding an additional type check:
Changing the type hint: