Completed
Push — master ( 06c1ce...67d37c )
by Jeroen
06:20
created

Controller/RulesAdminListController.php (1 issue)

Check for suspicious calls to parent methods

Bug Comprehensibility Minor

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
namespace Kunstmaan\LeadGenerationBundle\Controller;
4
5
use Kunstmaan\AdminListBundle\AdminList\Configurator\AdminListConfiguratorInterface;
6
use Kunstmaan\AdminListBundle\Controller\AdminListController;
7
use Kunstmaan\LeadGenerationBundle\AdminList\RulesAdminListConfigurator;
8
use Symfony\Component\Routing\Annotation\Route;
9
use Symfony\Component\HttpFoundation\Request;
10
11
class RulesAdminListController extends AdminListController
12
{
13
    /**
14
     * @var RulesAdminListConfigurator
15
     */
16
    private $configurator;
17
18
    /**
19
     * @return AdminListConfiguratorInterface
20
     */
21
    public function getAdminListConfigurator($id)
22
    {
23
        if (!isset($this->configurator)) {
24
            $this->configurator = new RulesAdminListConfigurator($this->getEntityManager(), null, $id);
25
        }
26
27
        return $this->configurator;
28
    }
29
30
    /**
31
     * The detail action
32
     *
33
     * @Route("/{popup}/rules", requirements={"popup" = "\d+"}, name="kunstmaanleadgenerationbundle_admin_rule_abstractrule_detail")
34
     */
35
    public function detailAction(Request $request, $popup)
36
    {
37
        return parent::doIndexAction($this->getAdminListConfigurator($popup), $request);
38
    }
39
40
    /**
41
     * The add action
42
     *
43
     * @Route("/{popup}/add", requirements={"popup" = "\d+"}, name="kunstmaanleadgenerationbundle_admin_rule_abstractrule_add", methods={"GET", "POST"})
44
     *
45
     * @return array
46
     */
47
    public function addAction(Request $request, $popup)
48
    {
49
        $type = $request->get('type');
50
51
        return parent::doAddAction($this->getAdminListConfigurator($popup), $type, $request);
0 ignored issues
show
Comprehensibility Bug introduced by
It seems like you call parent on a different method (doAddAction() instead of addAction()). Are you sure this is correct? If so, you might want to change this to $this->doAddAction().

This check looks for a call to a parent method whose name is different than the method from which it is called.

Consider the following code:

class Daddy
{
    protected function getFirstName()
    {
        return "Eidur";
    }

    protected function getSurName()
    {
        return "Gudjohnsen";
    }
}

class Son
{
    public function getFirstName()
    {
        return parent::getSurname();
    }
}

The getFirstName() method in the Son calls the wrong method in the parent class.

Loading history...
52
    }
53
54
    /**
55
     * The edit action
56
     *
57
     * @param int $id
58
     *
59
     * @Route("/{popup}/rules/{id}/edit", requirements={"popup" = "\d+", "rule" = "\d+"}, name="kunstmaanleadgenerationbundle_admin_rule_abstractrule_edit", methods={"GET", "POST"})
60
     *
61
     * @return array
62
     */
63
    public function editAction(Request $request, $id, $popup)
64
    {
65
        return parent::doEditAction($this->getAdminListConfigurator($popup), $id, $request);
66
    }
67
68
    /**
69
     * The delete action
70
     *
71
     * @param int $id
72
     *
73
     * @Route("/{popup}/rules/{id}/delete", requirements={"popup" = "\d+"}, name="kunstmaanleadgenerationbundle_admin_rule_abstractrule_delete", methods={"GET", "POST"})
74
     *
75
     * @return array
76
     */
77
    public function deleteAction(Request $request, $id, $popup)
78
    {
79
        return parent::doDeleteAction($this->getAdminListConfigurator($popup), $id, $request);
80
    }
81
}
82