open-orchestra/open-orchestra-cms-bundle

View on GitHub
GroupBundle/Controller/Api/GroupController.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\GroupBundle\Controller\Api\GroupController::get
Open

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

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

    public function listAction(Request $request, $withCount)

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

    public function duplicateAction(Request $request)

Call to undeclared method \OpenOrchestra\GroupBundle\Controller\Api\GroupController::get
Open

        $currentSite = $this->get('open_orchestra_model.repository.site')->findOneBySiteId($currentSiteId);

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

    public function listAction(Request $request, $withCount)

Call to method __construct from undeclared class \OpenOrchestra\UserBundle\Event\GroupEvent
Open

                $this->dispatchEvent(GroupEvents::GROUP_DELETE, new GroupEvent($group));

Reference to constant GROUP_DELETE from undeclared class \OpenOrchestra\UserBundle\GroupEvents
Open

            $this->dispatchEvent(GroupEvents::GROUP_DELETE, new GroupEvent($group));

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

    public function deleteGroupsAction(Request $request)

Call to undeclared method \OpenOrchestra\GroupBundle\Controller\Api\GroupController::get
Open

        $groupRepository = $this->get('open_orchestra_user.repository.group');

Call to undeclared method \OpenOrchestra\GroupBundle\Controller\Api\GroupController::get
Open

        $repository = $this->get('open_orchestra_user.repository.group');

Call to undeclared method \OpenOrchestra\GroupBundle\Controller\Api\GroupController::get
Open

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

Call to undeclared method \OpenOrchestra\GroupBundle\Controller\Api\GroupController::get
Open

                $this->get('open_orchestra_backoffice.business_rules_manager')->isGranted(BusinessActionInterface::DELETE, $group, $nbrGroupsUsers)

Call to undeclared method \OpenOrchestra\GroupBundle\Controller\Api\GroupController::denyAccessUnlessGranted
Open

        $this->denyAccessUnlessGranted(ContributionActionInterface::DELETE, $group);

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

class GroupController extends BaseController

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

            $request->getContent(),

Call to undeclared method \OpenOrchestra\GroupBundle\Controller\Api\GroupController::get
Open

        $nbrGroupsUsers = $this->get('open_orchestra_user.repository.user')->getCountsUsersByGroups($filter);

Call to undeclared method \OpenOrchestra\GroupBundle\Controller\Api\GroupController::dispatchEvent
Open

                $this->dispatchEvent(GroupEvents::GROUP_DELETE, new GroupEvent($group));

Call to method __construct from undeclared class \OpenOrchestra\UserBundle\Event\GroupEvent
Open

            $this->dispatchEvent(GroupEvents::GROUP_DELETE, new GroupEvent($group));

Call to undeclared method \OpenOrchestra\GroupBundle\Controller\Api\GroupController::getParameter
Open

            $this->getParameter('open_orchestra_group.facade.group_collection.class'),

Call to undeclared method \OpenOrchestra\GroupBundle\Controller\Api\GroupController::get
Open

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

Call to undeclared method \OpenOrchestra\GroupBundle\Controller\Api\GroupController::isGranted
Open

            if ($this->isGranted(ContributionActionInterface::DELETE, $group) &&

Call to undeclared method \OpenOrchestra\GroupBundle\Controller\Api\GroupController::get
Open

        $group = $this->get('open_orchestra_user.repository.group')->find($groupId);

Call to undeclared method \OpenOrchestra\GroupBundle\Controller\Api\GroupController::denyAccessUnlessGranted
Open

        $this->denyAccessUnlessGranted(ContributionActionInterface::CREATE, GroupInterface::ENTITY_TYPE);

Call to undeclared method \OpenOrchestra\GroupBundle\Controller\Api\GroupController::get
Open

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

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

        return array();

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

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

Reference to constant GROUP_DELETE from undeclared class \OpenOrchestra\UserBundle\GroupEvents
Open

                $this->dispatchEvent(GroupEvents::GROUP_DELETE, new GroupEvent($group));

Call to undeclared method \OpenOrchestra\GroupBundle\Controller\Api\GroupController::get
Open

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

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

    public function deleteGroupsAction(Request $request)

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

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

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

    public function deleteAction($groupId)

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

        return array();

Call to undeclared method \OpenOrchestra\GroupBundle\Controller\Api\GroupController::denyAccessUnlessGranted
Open

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

Call to undeclared method \OpenOrchestra\GroupBundle\Controller\Api\GroupController::get
Open

            $nbrGroupsUsers = $this->get('open_orchestra_user.repository.user')->getCountsUsersByGroups($filter);

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

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

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

            $request->getContent(),

Call to undeclared method \OpenOrchestra\GroupBundle\Controller\Api\GroupController::get
Open

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

Call to undeclared method \OpenOrchestra\GroupBundle\Controller\Api\GroupController::get
Open

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

Call to undeclared method \OpenOrchestra\GroupBundle\Controller\Api\GroupController::get
Open

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

Call to undeclared method \OpenOrchestra\GroupBundle\Controller\Api\GroupController::getParameter
Open

            $this->getParameter('open_orchestra_group.facade.group.class'),

Call to undeclared method \OpenOrchestra\GroupBundle\Controller\Api\GroupController::get
Open

        if ($group instanceof GroupInterface && $this->get('open_orchestra_backoffice.business_rules_manager')->isGranted(BusinessActionInterface::DELETE, $group)) {

Call to undeclared method \OpenOrchestra\GroupBundle\Controller\Api\GroupController::dispatchEvent
Open

            $this->dispatchEvent(GroupEvents::GROUP_DELETE, new GroupEvent($group));

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

use OpenOrchestra\BaseApiBundle\Controller\Annotation as Api;

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

    public function duplicateAction(Request $request)

Call to undeclared method \OpenOrchestra\GroupBundle\Controller\Api\GroupController::get
Open

        $availableSites = $this->get('open_orchestra_backoffice.context_backoffice_manager')->getAvailableSites();

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

use Sensio\Bundle\FrameworkExtraBundle\Configuration as Config;

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

        return array();

Each PHP statement must be on a line by itself
Open

            array_walk($filter, function(&$item) {$item = $item->getId();});

Expected 1 space after FUNCTION keyword; 0 found
Open

        array_walk($filter, function(&$item) {$item = $item->getId();});

Expected 1 space after FUNCTION keyword; 0 found
Open

            array_walk($filter, function(&$item) {$item = $item->getId();});

Each PHP statement must be on a line by itself
Open

        array_walk($filter, function(&$item) {$item = $item->getId();});

Line exceeds 120 characters; contains 165 characters
Open

        if ($group instanceof GroupInterface && $this->get('open_orchestra_backoffice.business_rules_manager')->isGranted(BusinessActionInterface::DELETE, $group)) {

Line exceeds 120 characters; contains 147 characters
Open

                $this->get('open_orchestra_backoffice.business_rules_manager')->isGranted(BusinessActionInterface::DELETE, $group, $nbrGroupsUsers)

Line exceeds 120 characters; contains 159 characters
Open

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

Closing brace must be on a line by itself
Open

            array_walk($filter, function(&$item) {$item = $item->getId();});

Opening brace must be the last content on the line
Open

        array_walk($filter, function(&$item) {$item = $item->getId();});

Closing brace must be on a line by itself
Open

        array_walk($filter, function(&$item) {$item = $item->getId();});

Opening brace must be the last content on the line
Open

            array_walk($filter, function(&$item) {$item = $item->getId();});

There are no issues that match your filters.

Category
Status