open-orchestra/open-orchestra-cms-bundle

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

        $repository =  $this->get('open_orchestra_model.repository.site');
Severity: Critical
Found in ApiBundle/Controller/SiteController.php by phan

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

        if ($site instanceof SiteInterface) {
Severity: Critical
Found in ApiBundle/Controller/SiteController.php by phan

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

            $this->dispatchEvent(SiteEvents::SITE_DELETE, new SiteEvent($site));
Severity: Critical
Found in ApiBundle/Controller/SiteController.php by phan

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

        $this->denyAccessUnlessGranted(ContributionActionInterface::READ, SiteInterface::ENTITY_TYPE);
Severity: Critical
Found in ApiBundle/Controller/SiteController.php by phan

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

        return array();

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

    public function listAvailableSiteAction()

Reference to constant SITE_DELETE from undeclared class \OpenOrchestra\ModelInterface\SiteEvents
Open

            $this->dispatchEvent(SiteEvents::SITE_DELETE, new SiteEvent($site));
Severity: Critical
Found in ApiBundle/Controller/SiteController.php by phan

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

            $this->dispatchEvent(SiteEvents::SITE_DELETE, new SiteEvent($site));
Severity: Critical
Found in ApiBundle/Controller/SiteController.php by phan

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

        $this->denyAccessUnlessGranted(ContributionActionInterface::READ, SiteInterface::ENTITY_TYPE);
Severity: Critical
Found in ApiBundle/Controller/SiteController.php by phan

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

        if (false === $this->get('security.authorization_checker')->isGranted(ContributionRoleInterface::PLATFORM_ADMIN)) {
Severity: Critical
Found in ApiBundle/Controller/SiteController.php by phan

Call to method setDeleted from undeclared class \OpenOrchestra\ModelInterface\Model\SiteInterface
Open

            $site->setDeleted(true);
Severity: Critical
Found in ApiBundle/Controller/SiteController.php by phan

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

        $availableSite = $this->get('open_orchestra_backoffice.context_backoffice_manager')->getAvailableSites();
Severity: Critical
Found in ApiBundle/Controller/SiteController.php by phan

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

        return $this->get('open_orchestra_api.transformer_manager')->transform('site_collection', $availableSite);
Severity: Critical
Found in ApiBundle/Controller/SiteController.php by phan

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

    public function deleteAction($siteId)

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

use OpenOrchestra\BaseApiBundle\Controller\Annotation as Api;

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

        $facade = $this->get('open_orchestra_api.transformer_manager')->transform('site_collection', $collection);
Severity: Critical
Found in ApiBundle/Controller/SiteController.php by phan

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

        $this->denyAccessUnlessGranted(ContributionActionInterface::DELETE, $site);
Severity: Critical
Found in ApiBundle/Controller/SiteController.php by phan

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

        $configuration = PaginateFinderConfiguration::generateFromRequest($request, $mapping);
Severity: Critical
Found in ApiBundle/Controller/SiteController.php by phan

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

        $site = $this->get('open_orchestra_model.repository.site')->findOneBySiteId($siteId);
Severity: Critical
Found in ApiBundle/Controller/SiteController.php by phan

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

use Sensio\Bundle\FrameworkExtraBundle\Configuration as Config;

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

    public function listAction(Request $request)

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

            $availableSites = $this->get('open_orchestra_backoffice.context_backoffice_manager')->getAvailableSites();
Severity: Critical
Found in ApiBundle/Controller/SiteController.php by phan

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

            $this->get('object_manager')->flush();
Severity: Critical
Found in ApiBundle/Controller/SiteController.php by phan

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

class SiteController extends BaseController
Severity: Critical
Found in ApiBundle/Controller/SiteController.php by phan

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

    public function listAction(Request $request)

Line exceeds 120 characters; contains 123 characters
Open

        if (false === $this->get('security.authorization_checker')->isGranted(ContributionRoleInterface::PLATFORM_ADMIN)) {

There are no issues that match your filters.

Category
Status