open-orchestra/open-orchestra-cms-bundle

View on GitHub
ApiBundle/Controller/TrashcanController.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\TrashcanController::get
Open

        $this->get('object_manager')->flush();

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

        $siteId = $this->get('open_orchestra_backoffice.context_backoffice_manager')->getSiteId();

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

class TrashcanController extends BaseController

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

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

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

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

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

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

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

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

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

            $this->get('open_orchestra_backoffice.trashcan_entity.manager')->restore($trashItem);

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

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

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

use OpenOrchestra\BaseApiBundle\Controller\Annotation as Api;

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

    public function listAction(Request $request)

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

            if ($this->isValid($trashItem, 'remove') && $this->isGranted(ContributionActionInterface::TRASH_PURGE)) {

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

                $this->get('open_orchestra_backoffice.trashcan_entity.manager')->remove($trashItem);

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

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

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

            $request->getContent(),

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

        $this->get('open_orchestra_model.repository.trash_item')->removeTrashItems($trashItemIds);

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

use Sensio\Bundle\FrameworkExtraBundle\Configuration as Config;

Call to undeclared method \OpenOrchestra\ApiBundle\Controller\TrashcanController::isValid
Open

            if ($this->isValid($trashItem, 'remove') && $this->isGranted(ContributionActionInterface::TRASH_PURGE)) {

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

        $this->denyAccessUnlessGranted(ContributionActionInterface::TRASH_RESTORE, $trashItem);

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

    public function listAction(Request $request)

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

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

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

        $trashItem = $this->get('open_orchestra_model.repository.trash_item')->find($trashItemId);

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

        if ($trashItem instanceof TrashItemInterface) {

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

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

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

    public function deleteTrashItemsAction(Request $request)

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

            $om = $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 127 characters
Open

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

There are no issues that match your filters.

Category
Status