open-orchestra/open-orchestra-cms-bundle

View on GitHub
BackofficeBundle/Command/OrchestraDeleteSiteCommand.php

Summary

Maintainability
A
1 hr
Test Coverage

Method execute has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $io = new SymfonyStyle($input, $output);

        $siteRepository = $this->getContainer()->get('open_orchestra_model.repository.site');
Severity: Minor
Found in BackofficeBundle/Command/OrchestraDeleteSiteCommand.php - About 1 hr to fix

Missing class import via use statement (line '102', column '23').
Open

            throw new \RuntimeException('You should remove usage of contents before remove site '.$siteId);

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '93', column '23').
Open

            throw new \RuntimeException('You should remove usage of nodes before remove site '.$siteId);

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Parameter $output has undeclared type \Symfony\Component\Console\Output\OutputInterface
Open

    protected function execute(InputInterface $input, OutputInterface $output)

Call to undeclared method \OpenOrchestra\BackofficeBundle\Command\OrchestraDeleteSiteCommand::getContainer
Open

        $contentRepository = $this->getContainer()->get('open_orchestra_model.repository.content');

Call to method error from undeclared class \Symfony\Component\Console\Style\SymfonyStyle
Open

            $io->error('Site '.$siteId.' not found');

Call to method comment from undeclared class \Symfony\Component\Console\Style\SymfonyStyle
Open

        $io->comment('Remove use references of nodes');

Call to method comment from undeclared class \Symfony\Component\Console\Style\SymfonyStyle
Open

        $io->comment('Check usage in other sites');

Call to undeclared method \OpenOrchestra\BackofficeBundle\Command\OrchestraDeleteSiteCommand::getContainer
Open

        $nodeClass = $this->getContainer()->getParameter('open_orchestra_model.document.node.class');

Call to undeclared method \OpenOrchestra\BackofficeBundle\Command\OrchestraDeleteSiteCommand::getContainer
Open

        $deleteSiteTools = $this->getContainer()->get('open_orchestra_backoffice.command.orchestra_delete_site_tools');

Call to undeclared method \OpenOrchestra\BackofficeBundle\Command\OrchestraDeleteSiteCommand::getContainer
Open

        $nodeRepository = $this->getContainer()->get('open_orchestra_model.repository.node');

Parameter $io has undeclared type \Symfony\Component\Console\Style\SymfonyStyle
Open

    protected function deleteEntities($siteId, $io)

Call to undeclared method \OpenOrchestra\BackofficeBundle\Command\OrchestraDeleteSiteCommand::getContainer
Open

        $contentRepository = $this->getContainer()->get('open_orchestra_model.repository.content');

Call to undeclared method \OpenOrchestra\BackofficeBundle\Command\OrchestraDeleteSiteCommand::getContainer
Open

        $siteRepository = $this->getContainer()->get('open_orchestra_model.repository.site');

Call to method section from undeclared class \Symfony\Component\Console\Style\SymfonyStyle
Open

            $io->section('Usage of contents in other sites');

Call to method comment from undeclared class \Symfony\Component\Console\Style\SymfonyStyle
Open

        $io->comment('Remove use references of blocks');

Call to undeclared method \OpenOrchestra\BackofficeBundle\Command\OrchestraDeleteSiteCommand::getContainer
Open

        $nodeRepository = $this->getContainer()->get('open_orchestra_model.repository.node');

Call to method comment from undeclared class \Symfony\Component\Console\Style\SymfonyStyle
Open

        $io->comment('Remove use references of contents');

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

        if (false === $site->isDeleted()) {

Call to undeclared method \OpenOrchestra\BackofficeBundle\Command\OrchestraDeleteSiteCommand::getContainer
Open

        $deleteSiteTools = $this->getContainer()->get('open_orchestra_backoffice.command.orchestra_delete_site_tools');

Call to undeclared method \OpenOrchestra\BackofficeBundle\Command\OrchestraDeleteSiteCommand::getContainer
Open

        $routeDocumentRepository = $this->getContainer()->get('open_orchestra_model.repository.route_document');

Call to method comment from undeclared class \Symfony\Component\Console\Style\SymfonyStyle
Open

        $io->comment('Remove blocks');

Call to undeclared method \OpenOrchestra\BackofficeBundle\Command\OrchestraDeleteSiteCommand::getContainer
Open

        $blockRepository = $this->getContainer()->get('open_orchestra_model.repository.block');

Class extends undeclared class \Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand
Open

class OrchestraDeleteSiteCommand extends ContainerAwareCommand

Call to undeclared method \OpenOrchestra\BackofficeBundle\Command\OrchestraDeleteSiteCommand::getContainer
Open

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

Call to method comment from undeclared class \Symfony\Component\Console\Style\SymfonyStyle
Open

        $io->comment('Remove nodes');

Call to method section from undeclared class \Symfony\Component\Console\Style\SymfonyStyle
Open

            $io->section('Usage of nodes in other sites');

Reference to constant REQUIRED from undeclared class \Symfony\Component\Console\Input\InputArgument
Open

            ->addArgument('siteId', InputArgument::REQUIRED);

Call to undeclared method \OpenOrchestra\BackofficeBundle\Command\OrchestraDeleteSiteCommand::getContainer
Open

        $dispatcher = $this->getContainer()->get('event_dispatcher');

Call to method comment from undeclared class \Symfony\Component\Console\Style\SymfonyStyle
Open

        $io->comment('Remove route document');

Call to undeclared method \OpenOrchestra\BackofficeBundle\Command\OrchestraDeleteSiteCommand::getContainer
Open

        $contentClass = $this->getContainer()->getParameter('open_orchestra_model.document.content.class');

Call to undeclared method \OpenOrchestra\BackofficeBundle\Command\OrchestraDeleteSiteCommand::setName
Open

        $this

Call to method comment from undeclared class \Symfony\Component\Console\Style\SymfonyStyle
Open

        $io->comment('Check site');

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

        if (!$site instanceof SiteInterface) {

Call to method error from undeclared class \Symfony\Component\Console\Style\SymfonyStyle
Open

            $io->error('Site '.$siteId.' should be soft deleted');

Call to undeclared method \OpenOrchestra\BackofficeBundle\Command\OrchestraDeleteSiteCommand::getContainer
Open

        $blockClass = $this->getContainer()->getParameter('open_orchestra_model.document.block.class');

Call to method comment from undeclared class \Symfony\Component\Console\Style\SymfonyStyle
Open

        $io->comment('Remove site');

Parameter $input has undeclared type \Symfony\Component\Console\Input\InputInterface
Open

    protected function execute(InputInterface $input, OutputInterface $output)

Call to method __construct from undeclared class \Symfony\Component\Console\Style\SymfonyStyle
Open

        $io = new SymfonyStyle($input, $output);

Call to method comment from undeclared class \Symfony\Component\Console\Style\SymfonyStyle
Open

        $io->comment('Remove contents');

Call to method getArgument from undeclared class \Symfony\Component\Console\Input\InputInterface
Open

        $siteId = $input->getArgument('siteId');

Parameter $io has undeclared type \Symfony\Component\Console\Style\SymfonyStyle
Open

    protected function checkUsage($siteId, SymfonyStyle $io)

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

        $routeDocumentRepository = $this->getContainer()->get('open_orchestra_model.repository.route_document');

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 $io. Configured minimum length is 3.
Open

    protected function deleteEntities($siteId, $io)

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

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

    protected function checkUsage($siteId, SymfonyStyle $io)

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

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

        $io = new SymfonyStyle($input, $output);

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 122 characters
Open

        $routeDocumentRepository->createQueryBuilder()->field('siteId')->equals($siteId)->remove()->getQuery()->execute();

There are no issues that match your filters.

Category
Status