Conditions | 4 |
Paths | 4 |
Total Lines | 27 |
Lines | 17 |
Ratio | 62.96 % |
Changes | 0 |
1 | <?php |
||
21 | public function indexAction() |
||
22 | { |
||
23 | $form = new RobotsForm(); |
||
24 | |||
25 | View Code Duplication | 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; |
||
45 | |||
46 | |||
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: