open-orchestra/open-orchestra-cms-bundle

View on GitHub

Showing 354 of 14,363 total issues

The class RouteDocumentManagerTest has 12 public methods. Consider refactoring RouteDocumentManagerTest to keep number of public methods under 10.
Open

class RouteDocumentManagerTest extends AbstractBaseTestCase
{
    /**
     * @var RouteDocumentManager
     */

TooManyPublicMethods

Since: 0.1

A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

By default it ignores methods starting with 'get' or 'set'.

Example

Source https://phpmd.org/rules/codesize.html#toomanypublicmethods

File ContentController.php has 304 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace OpenOrchestra\ApiBundle\Controller;

use OpenOrchestra\ApiBundle\Controller\ControllerTrait\ListStatus;
Severity: Minor
Found in ApiBundle/Controller/ContentController.php - About 3 hrs to fix

Function execute has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $io = new SymfonyStyle($input, $output);
        $aliasId = $input->getArgument('aliasId');
        $limit = 20;
Severity: Minor
Found in BackofficeBundle/Command/OrchestraDeleteAliasCommand.php - About 3 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method addTemplateSetConfiguration has 80 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function addTemplateSetConfiguration()
    {
        $builder = new TreeBuilder();
        $templateSet = $builder->root('template_set');

Severity: Major
Found in BackofficeBundle/DependencyInjection/Configuration.php - About 3 hrs to fix

File Configuration.php has 299 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace OpenOrchestra\BackofficeBundle\DependencyInjection;

use OpenOrchestra\ModelInterface\Model\ContentInterface;
Severity: Minor
Found in BackofficeBundle/DependencyInjection/Configuration.php - About 3 hrs to fix

Method buildForm has 78 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
            ->add('names', 'oo_multi_languages', array(
                'label' => 'open_orchestra_backoffice.form.content_type.names',
Severity: Major
Found in Backoffice/Form/Type/ContentTypeType.php - About 3 hrs to fix

Method buildForm has 77 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
            ->add('scheme', 'choice', array(
                'choices' => $this->schemeChoices,
Severity: Major
Found in Backoffice/Form/Type/SiteAliasType.php - About 3 hrs to fix

Method buildForm has 74 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $sitesId = array();
        $disabled = false;
        if (array_key_exists('data', $options) && ($user = $options['data']) instanceof UserInterface) {
Severity: Major
Found in UserAdminBundle/Form/Type/UserType.php - About 2 hrs to fix

Function findUsageReferenceInOtherSite has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

    public function findUsageReferenceInOtherSite($siteId, $entities)
    {
        $usedOtherSite = array();
        $supportedEntities = array(BlockInterface::ENTITY_TYPE, ContentInterface::ENTITY_TYPE);
        /** @var UseTrackableInterface $entity */
Severity: Minor
Found in Backoffice/Command/OrchestraDeleteSiteTools.php - About 2 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function reverseTransform has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

    public function reverseTransform($value)
    {
        $result = new ArrayCollection();
        if (is_array($value)) {
            foreach ($value as $key => $profiles) {

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method buildForm has 70 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
            ->add('name', 'text', array(
                'label' => 'open_orchestra_backoffice.form.website.name',
Severity: Major
Found in Backoffice/Form/Type/SiteType.php - About 2 hrs to fix

Method getBadRoles has 68 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function getBadRoles()
    {
        $keyword = $this->createPhakeKeyword();

        return array(

ContextManagerTest has 24 functions (exceeds 20 allowed). Consider refactoring.
Open

class ContextManagerTest extends AbstractBaseTestCase
{
    /**
     * @var ContextManager
     */
Severity: Minor
Found in Backoffice/Tests/Context/ContextManagerTest.php - About 2 hrs to fix

Method getConfigTreeBuilder has 64 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function getConfigTreeBuilder()
    {
        $treeBuilder = new TreeBuilder();
        $rootNode = $treeBuilder->root('open_orchestra_backoffice');

Severity: Major
Found in BackofficeBundle/DependencyInjection/Configuration.php - About 2 hrs to fix

Method updateBlockConfiguration has 63 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function updateBlockConfiguration(ContainerBuilder $container, array $config)
    {
        $backOfficeBlockConfiguration = array(
            FooterStrategy::NAME => array(
                'category' => 'open_orchestra_backoffice.block_configuration.category.navigation',

ContextBackOfficeManagerTest has 23 functions (exceeds 20 allowed). Consider refactoring.
Open

class ContextBackOfficeManagerTest extends AbstractBaseTestCase
{
    /**
     * @var ContextBackOfficeManager
     */
Severity: Minor
Found in Backoffice/Tests/Context/ContextBackOfficeManagerTest.php - About 2 hrs to fix

AbstractVoterTest has 23 functions (exceeds 20 allowed). Consider refactoring.
Open

abstract class AbstractVoterTest extends AbstractBaseTestCase
{
    protected $voter;

    protected $perimeterManager;
Severity: Minor
Found in Backoffice/Tests/Security/Authorization/Voter/AbstractVoterTest.php - About 2 hrs to fix

File symlink.js has 270 lines of code (exceeds 250 allowed). Consider refactoring.
Open

module.exports = {
    //--[ FONT MONTSERRAT ]--//
    font_montserrat_700_eot: {
        src: 'web/bundles/openorchestrabackoffice/font/Montserrat/fonts/Montserrat-700/Montserrat-700.eot',
        dest: 'web/fonts/Montserrat-700/Montserrat-700.eot'
Severity: Minor
Found in GruntTasks/Targets/symlink.js - About 2 hrs to fix

Method testConfigureOptions has 62 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function testConfigureOptions()
    {
        $resolver = Phake::mock('Symfony\Component\OptionsResolver\OptionsResolver');

        $this->form->configureOptions($resolver);
Severity: Major
Found in Backoffice/Tests/Form/Type/SiteTypeTest.php - About 2 hrs to fix

Method configureOptions has 62 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function configureOptions(OptionsResolver $resolver)
    {
        $subGroupRender = array(
            'properties' => array(
                'rank' => 0,
Severity: Major
Found in Backoffice/Form/Type/NodeType.php - About 2 hrs to fix
Severity
Category
Status
Source
Language