Completed
Push — master ( 6c15b7...f5f8be )
by Sander
12:00
created

RedirectAdminListController::editAction()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
1
<?php
2
3
namespace Kunstmaan\RedirectBundle\Controller;
4
5
use Kunstmaan\AdminListBundle\AdminList\Configurator\AdminListConfiguratorInterface;
6
use Kunstmaan\AdminListBundle\Controller\AdminListController;
7
use Kunstmaan\RedirectBundle\AdminList\RedirectAdminListConfigurator;
8
use Symfony\Component\Routing\Annotation\Route;
9
use Symfony\Component\HttpFoundation\Request;
10
use Symfony\Component\HttpFoundation\Response;
11
12
class RedirectAdminListController extends AdminListController
13
{
14
    /**
15
     * @var AdminListConfiguratorInterface
16
     */
17
    private $configurator;
18
19
    /**
20
     * @return AdminListConfiguratorInterface
21
     */
22
    public function getAdminListConfigurator()
23
    {
24
        if (!isset($this->configurator)) {
25
            $this->configurator = new RedirectAdminListConfigurator($this->getEntityManager(), null, $this->container->get('kunstmaan_admin.domain_configuration'));
0 ignored issues
show
Compatibility introduced by
$this->getEntityManager() of type object<Doctrine\Common\Persistence\ObjectManager> is not a sub-type of object<Doctrine\ORM\EntityManager>. It seems like you assume a concrete implementation of the interface Doctrine\Common\Persistence\ObjectManager to be always present.

This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass.

Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.

Loading history...
26
        }
27
28
        return $this->configurator;
29
    }
30
31
    /**
32
     * The index action
33
     *
34
     * @Route("/", name="kunstmaanredirectbundle_admin_redirect")
35
     */
36
    public function indexAction(Request $request)
37
    {
38
        return parent::doIndexAction($this->getAdminListConfigurator(), $request);
0 ignored issues
show
Compatibility introduced by
$this->getAdminListConfigurator() of type object<Kunstmaan\AdminLi...tConfiguratorInterface> is not a sub-type of object<Kunstmaan\AdminLi...tAdminListConfigurator>. It seems like you assume a concrete implementation of the interface Kunstmaan\AdminListBundl...stConfiguratorInterface to be always present.

This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass.

Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.

Loading history...
Comprehensibility Bug introduced by
It seems like you call parent on a different method (doIndexAction() instead of indexAction()). Are you sure this is correct? If so, you might want to change this to $this->doIndexAction().

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...
39
    }
40
41
    /**
42
     * The add action
43
     *
44
     * @Route("/add", name="kunstmaanredirectbundle_admin_redirect_add", methods={"GET", "POST"})
45
     *
46
     * @return Response
47
     */
48
    public function addAction(Request $request)
49
    {
50
        return parent::doAddAction($this->getAdminListConfigurator(), null, $request);
0 ignored issues
show
Compatibility introduced by
$this->getAdminListConfigurator() of type object<Kunstmaan\AdminLi...tConfiguratorInterface> is not a sub-type of object<Kunstmaan\AdminLi...tAdminListConfigurator>. It seems like you assume a concrete implementation of the interface Kunstmaan\AdminListBundl...stConfiguratorInterface to be always present.

This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass.

Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.

Loading history...
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...
51
    }
52
53
    /**
54
     * The edit action
55
     *
56
     * @param int $id
57
     *
58
     * @Route("/{id}", requirements={"id" = "\d+"}, name="kunstmaanredirectbundle_admin_redirect_edit", methods={"GET", "POST"})
59
     *
60
     * @return Response
61
     */
62
    public function editAction(Request $request, $id)
63
    {
64
        return parent::doEditAction($this->getAdminListConfigurator(), $id, $request);
0 ignored issues
show
Compatibility introduced by
$this->getAdminListConfigurator() of type object<Kunstmaan\AdminLi...tConfiguratorInterface> is not a sub-type of object<Kunstmaan\AdminLi...tAdminListConfigurator>. It seems like you assume a concrete implementation of the interface Kunstmaan\AdminListBundl...stConfiguratorInterface to be always present.

This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass.

Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.

Loading history...
Comprehensibility Bug introduced by
It seems like you call parent on a different method (doEditAction() instead of editAction()). Are you sure this is correct? If so, you might want to change this to $this->doEditAction().

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...
65
    }
66
67
    /**
68
     * The delete action
69
     *
70
     * @param int $id
71
     *
72
     * @Route("/{id}/delete", requirements={"id" = "\d+"}, name="kunstmaanredirectbundle_admin_redirect_delete", methods={"GET", "POST"})
73
     *
74
     * @return Response
75
     */
76
    public function deleteAction(Request $request, $id)
77
    {
78
        return parent::doDeleteAction($this->getAdminListConfigurator(), $id, $request);
0 ignored issues
show
Compatibility introduced by
$this->getAdminListConfigurator() of type object<Kunstmaan\AdminLi...tConfiguratorInterface> is not a sub-type of object<Kunstmaan\AdminLi...tAdminListConfigurator>. It seems like you assume a concrete implementation of the interface Kunstmaan\AdminListBundl...stConfiguratorInterface to be always present.

This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass.

Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.

Loading history...
Comprehensibility Bug introduced by
It seems like you call parent on a different method (doDeleteAction() instead of deleteAction()). Are you sure this is correct? If so, you might want to change this to $this->doDeleteAction().

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...
79
    }
80
81
    /**
82
     * The export action
83
     *
84
     * @param string $_format
85
     *
86
     * @Route("/export.{_format}", requirements={"_format" = "csv|xlsx|ods"}, name="kunstmaanredirectbundle_admin_redirect_export", methods={"GET", "POST"})
87
     *
88
     * @return Response
89
     */
90
    public function exportAction(Request $request, $_format)
91
    {
92
        return parent::doExportAction($this->getAdminListConfigurator(), $_format, $request);
0 ignored issues
show
Compatibility introduced by
$this->getAdminListConfigurator() of type object<Kunstmaan\AdminLi...tConfiguratorInterface> is not a sub-type of object<Kunstmaan\AdminLi...tAdminListConfigurator>. It seems like you assume a concrete implementation of the interface Kunstmaan\AdminListBundl...stConfiguratorInterface to be always present.

This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass.

Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.

Loading history...
Comprehensibility Bug introduced by
It seems like you call parent on a different method (doExportAction() instead of exportAction()). Are you sure this is correct? If so, you might want to change this to $this->doExportAction().

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...
93
    }
94
}
95