open-orchestra/open-orchestra-cms-bundle

View on GitHub
ApiBundle/Controller/RedirectionController.php

Summary

Maintainability
A
0 mins
Test Coverage

Avoid using static access to class '\OpenOrchestra\Pagination\Configuration\PaginateFinderConfiguration' in method 'listAction'.
Open

        $configuration = PaginateFinderConfiguration::generateFromRequest($request, $mapping);

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

Source https://phpmd.org/rules/cleancode.html#staticaccess

Call to undeclared method \OpenOrchestra\ApiBundle\Controller\RedirectionController::get
Open

        $repository = $this->get('open_orchestra_model.repository.redirection');

Call to method get from undeclared class \Symfony\Component\HttpFoundation\Request
Open

        $format = $request->get('_format', 'json');

Call to undeclared method \OpenOrchestra\ApiBundle\Controller\RedirectionController::getParameter
Open

            $this->getParameter('open_orchestra_api.facade.redirection_collection.class'),

Call to method __construct from undeclared class \OpenOrchestra\ModelInterface\Event\RedirectionEvent
Open

        $this->dispatchEvent(RedirectionEvents::REDIRECTION_DELETE, new RedirectionEvent($redirection));

Call to undeclared method \OpenOrchestra\ApiBundle\Controller\RedirectionController::dispatchEvent
Open

        $this->dispatchEvent(RedirectionEvents::REDIRECTION_DELETE, new RedirectionEvent($redirection));

Call to undeclared method \OpenOrchestra\ApiBundle\Controller\RedirectionController::get
Open

        $redirection = $this->get('open_orchestra_model.repository.redirection')->find($redirectionId);

Possibly zero references to use statement for classlike/namespace Config (\Sensio\Bundle\FrameworkExtraBundle\Configuration)
Open

use Sensio\Bundle\FrameworkExtraBundle\Configuration as Config;

Reference to constant REDIRECTION_DELETE from undeclared class \OpenOrchestra\ModelInterface\RedirectionEvents
Open

        $this->dispatchEvent(RedirectionEvents::REDIRECTION_DELETE, new RedirectionEvent($redirection));

Return type of listAction() is undeclared type \OpenOrchestra\BaseApi\Facade\FacadeInterface
Open

    public function listAction(Request $request)

Possibly zero references to use statement for classlike/namespace Api (\OpenOrchestra\BaseApiBundle\Controller\Annotation)
Open

use OpenOrchestra\BaseApiBundle\Controller\Annotation as Api;

Class extends undeclared class \OpenOrchestra\BaseApiBundle\Controller\BaseController
Open

class RedirectionController extends BaseController

Call to undeclared method \OpenOrchestra\ApiBundle\Controller\RedirectionController::get
Open

        return $this->get('open_orchestra_api.transformer_manager')->transform('redirection_collection', $redirectionList);

Parameter $request has undeclared type \Symfony\Component\HttpFoundation\Request
Open

    public function listAction(Request $request)

Return type of listRedirectionNodeAction() is undeclared type \OpenOrchestra\BaseApi\Facade\FacadeInterface
Open

    public function listRedirectionNodeAction($siteId, $nodeId, $locale)

Reference to constant REDIRECTION_DELETE from undeclared class \OpenOrchestra\ModelInterface\RedirectionEvents
Open

                $this->dispatchEvent(RedirectionEvents::REDIRECTION_DELETE, new RedirectionEvent($redirection));

Call to undeclared method \OpenOrchestra\ApiBundle\Controller\RedirectionController::dispatchEvent
Open

                $this->dispatchEvent(RedirectionEvents::REDIRECTION_DELETE, new RedirectionEvent($redirection));

Return type of deleteAction() is undeclared type \Symfony\Component\HttpFoundation\Response
Open

    public function deleteAction($redirectionId)

Call to undeclared method \OpenOrchestra\ApiBundle\Controller\RedirectionController::denyAccessUnlessGranted
Open

        $this->denyAccessUnlessGranted(ContributionActionInterface::READ, RedirectionInterface::ENTITY_TYPE);

Call to undeclared method \OpenOrchestra\ApiBundle\Controller\RedirectionController::isGranted
Open

            if ($this->isGranted(ContributionActionInterface::DELETE, $redirection)) {

Call to undeclared method \OpenOrchestra\ApiBundle\Controller\RedirectionController::get
Open

        $dm = $this->get('object_manager');

Checking instanceof against undeclared class \OpenOrchestra\ModelInterface\Model\NodeInterface
Open

        if (!$node instanceof NodeInterface) {

Parameter $request has undeclared type \Symfony\Component\HttpFoundation\Request
Open

    public function deleteRedirectionsAction(Request $request)

Call to undeclared method \OpenOrchestra\ApiBundle\Controller\RedirectionController::get
Open

        $facade = $this->get('jms_serializer')->deserialize(

Call to method getContent from undeclared class \Symfony\Component\HttpFoundation\Request
Open

            $request->getContent(),

Returning type array{} but deleteRedirectionsAction() is declared to return \Symfony\Component\HttpFoundation\Response
Open

        return array();

Call to method __construct from undeclared class \OpenOrchestra\DisplayBundle\Exception\NodeNotFoundException
Open

            throw new NodeNotFoundException();

Return type of deleteRedirectionsAction() is undeclared type \Symfony\Component\HttpFoundation\Response
Open

    public function deleteRedirectionsAction(Request $request)

Call to undeclared method \OpenOrchestra\ApiBundle\Controller\RedirectionController::get
Open

        $node = $this->get('open_orchestra_model.repository.node')->findOneByNodeAndSite($nodeId, $siteId);

Call to undeclared method \OpenOrchestra\ApiBundle\Controller\RedirectionController::get
Open

        $redirections = $this->get('open_orchestra_api.transformer_manager')->reverseTransform('redirection_collection', $facade);

Call to method __construct from undeclared class \OpenOrchestra\ModelInterface\Event\RedirectionEvent
Open

                $this->dispatchEvent(RedirectionEvents::REDIRECTION_DELETE, new RedirectionEvent($redirection));

Call to method generateFromRequest from undeclared class \OpenOrchestra\Pagination\Configuration\PaginateFinderConfiguration
Open

        $configuration = PaginateFinderConfiguration::generateFromRequest($request, $mapping);

Call to undeclared method \OpenOrchestra\ApiBundle\Controller\RedirectionController::get
Open

        $redirectionRepository = $this->get('open_orchestra_model.repository.redirection');

Call to undeclared method \OpenOrchestra\ApiBundle\Controller\RedirectionController::denyAccessUnlessGranted
Open

        $this->denyAccessUnlessGranted(ContributionActionInterface::READ, $node);

Call to undeclared method \OpenOrchestra\ApiBundle\Controller\RedirectionController::get
Open

        $repository = $this->get('open_orchestra_model.repository.redirection');

Call to undeclared method \OpenOrchestra\ApiBundle\Controller\RedirectionController::get
Open

        $facade = $this->get('open_orchestra_api.transformer_manager')->transform('redirection_collection', $collection);

Reference to constant ENTITY_TYPE from undeclared class \OpenOrchestra\ModelInterface\Model\RedirectionInterface
Open

        $this->denyAccessUnlessGranted(ContributionActionInterface::READ, RedirectionInterface::ENTITY_TYPE);

Returning type array{} but deleteAction() is declared to return \Symfony\Component\HttpFoundation\Response
Open

        return array();

Avoid excessively long variable names like $redirectionRepository. Keep variable name length under 20.
Open

        $redirectionRepository = $this->get('open_orchestra_model.repository.redirection');

LongVariable

Since: 0.2

Detects when a field, formal or local variable is declared with a long name.

Example

class Something {
    protected $reallyLongIntName = -3; // VIOLATION - Field
    public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
        $otherReallyLongName = -5; // VIOLATION - Local
        for ($interestingIntIndex = 0; // VIOLATION - For
             $interestingIntIndex < 10;
             $interestingIntIndex++ ) {
        }
    }
}

Source https://phpmd.org/rules/naming.html#longvariable

Avoid variables with short names like $dm. Configured minimum length is 3.
Open

        $dm = $this->get('object_manager');

ShortVariable

Since: 0.2

Detects when a field, local, or parameter has a very short name.

Example

class Something {
    private $q = 15; // VIOLATION - Field
    public static function main( array $as ) { // VIOLATION - Formal
        $r = 20 + $this->q; // VIOLATION - Local
        for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
            $r += $this->q;
        }
    }
}

Source https://phpmd.org/rules/naming.html#shortvariable

Line exceeds 120 characters; contains 121 characters
Open

        $facade = $this->get('open_orchestra_api.transformer_manager')->transform('redirection_collection', $collection);

Line exceeds 120 characters; contains 123 characters
Open

        return $this->get('open_orchestra_api.transformer_manager')->transform('redirection_collection', $redirectionList);

Line exceeds 120 characters; contains 130 characters
Open

        $redirections = $this->get('open_orchestra_api.transformer_manager')->reverseTransform('redirection_collection', $facade);

There are no issues that match your filters.

Category
Status