open-orchestra/open-orchestra-cms-bundle

View on GitHub
ApiBundle/Transformer/RedirectionTransformer.php

Summary

Maintainability
A
0 mins
Test Coverage

Avoid unused parameters such as '$params'.
Open

    public function reverseTransform(FacadeInterface $facade, array $params = array())

UnusedFormalParameter

Since: 0.2

Avoid passing parameters to methods or constructors and then not using those parameters.

Example

class Foo
{
    private function bar($howdy)
    {
        // $howdy is not used
    }
}

Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter

Avoid unused parameters such as '$params'.
Open

    public function transform($redirection, array $params = array())

UnusedFormalParameter

Since: 0.2

Avoid passing parameters to methods or constructors and then not using those parameters.

Example

class Foo
{
    private function bar($howdy)
    {
        // $howdy is not used
    }
}

Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter

Class extends undeclared class \OpenOrchestra\BaseApi\Transformer\AbstractSecurityCheckerAwareTransformer
Open

class RedirectionTransformer extends AbstractSecurityCheckerAwareTransformer

@throws type of transform has undeclared type \OpenOrchestra\BaseApi\Exceptions\TransformerParameterTypeException
Open

    public function transform($redirection, array $params = array())

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

        if (!$redirection instanceof RedirectionInterface) {

Call to method getNodeId from undeclared class \OpenOrchestra\ModelInterface\Model\RedirectionInterface
Open

            $facade->redirection = $redirection->getNodeId();

Call to method getLocale from undeclared class \OpenOrchestra\ModelInterface\Model\RedirectionInterface
Open

        $facade->locale = $redirection->getLocale();

Call to method getNodeId from undeclared class \OpenOrchestra\ModelInterface\Model\RedirectionInterface
Open

        if ($redirection->getNodeId()) {

Call to method __construct from undeclared class \OpenOrchestra\BaseApi\Exceptions\TransformerParameterTypeException
Open

            throw new TransformerParameterTypeException();

Call to method getSiteName from undeclared class \OpenOrchestra\ModelInterface\Model\RedirectionInterface
Open

        $facade->siteName = $redirection->getSiteName();

Call to method getRoutePattern from undeclared class \OpenOrchestra\ModelInterface\Model\RedirectionInterface
Open

        $facade->routePattern = $redirection->getRoutePattern();

Reference to undeclared property \OpenOrchestra\ApiBundle\Transformer\RedirectionTransformer->authorizationChecker
Open

        $facade->addRight('can_delete', $this->authorizationChecker->isGranted(ContributionActionInterface::DELETE, $redirection));

Parameter $facade has undeclared type \OpenOrchestra\BaseApi\Facade\FacadeInterface
Open

    public function reverseTransform(FacadeInterface $facade, array $params = array())

Reference to instance property id from undeclared class \OpenOrchestra\BaseApi\Facade\FacadeInterface
Open

            return $this->redirectionRepository->find($facade->id);

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

    public function transform($redirection, array $params = array())

Reference to undeclared class \OpenOrchestra\BaseApi\Transformer\AbstractSecurityCheckerAwareTransformer
Open

        parent::__construct($facadeClass, $authorizationChecker);

Call to method getUrl from undeclared class \OpenOrchestra\ModelInterface\Model\RedirectionInterface
Open

        $facade->redirection = $redirection->getUrl();

Parameter $authorizationChecker has undeclared type \Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface
Open

    public function __construct(

Parameter $redirection has undeclared type \OpenOrchestra\ModelInterface\Model\RedirectionInterface
Open

    public function transform($redirection, array $params = array())

Call to method find from undeclared class \OpenOrchestra\ModelInterface\Repository\RedirectionRepositoryInterface
Open

            return $this->redirectionRepository->find($facade->id);

Call to method getId from undeclared class \OpenOrchestra\ModelInterface\Model\RedirectionInterface
Open

        $facade->id = $redirection->getId();

Call to method isPermanent from undeclared class \OpenOrchestra\ModelInterface\Model\RedirectionInterface
Open

        $facade->permanent = $redirection->isPermanent();

Parameter $redirectionRepository has undeclared type \OpenOrchestra\ModelInterface\Repository\RedirectionRepositoryInterface
Open

    public function __construct(

Call to undeclared method \OpenOrchestra\ApiBundle\Transformer\RedirectionTransformer::newFacade
Open

        $facade = $this->newFacade();

Reference to undeclared property \OpenOrchestra\ApiBundle\Transformer\RedirectionTransformer->authorizationChecker
Open

        $facade->addRight('can_edit', $this->authorizationChecker->isGranted(ContributionActionInterface::EDIT, $redirection));

Reference to instance property id from undeclared class \OpenOrchestra\BaseApi\Facade\FacadeInterface
Open

        if (null !== $facade->id) {

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

        RedirectionRepositoryInterface $redirectionRepository

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 excessively long variable names like $redirectionRepository. Keep variable name length under 20.
Open

    protected $redirectionRepository;

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

Line exceeds 120 characters; contains 127 characters
Open

        $facade->addRight('can_edit', $this->authorizationChecker->isGranted(ContributionActionInterface::EDIT, $redirection));

Line exceeds 120 characters; contains 131 characters
Open

        $facade->addRight('can_delete', $this->authorizationChecker->isGranted(ContributionActionInterface::DELETE, $redirection));

There are no issues that match your filters.

Category
Status