open-orchestra/open-orchestra-model-bundle

View on GitHub

Showing 58 of 72 total issues

File NodeRepository.php has 757 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace OpenOrchestra\ModelBundle\Repository;

use Doctrine\Common\Collections\Collection;
Severity: Major
Found in ModelBundle/Repository/NodeRepository.php - About 1 day to fix

NodeRepository has 66 functions (exceeds 20 allowed). Consider refactoring.
Open

class NodeRepository extends AbstractAggregateRepository implements FieldAutoGenerableRepositoryInterface, NodeRepositoryInterface
{
    use AutoPublishableTrait;
    use UseTrackableTrait;
    use StatusableTrait;
Severity: Major
Found in ModelBundle/Repository/NodeRepository.php - About 1 day to fix

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

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

Severity: Major
Found in ModelBundle/DependencyInjection/Configuration.php - About 7 hrs to fix

RouteDocument has 41 functions (exceeds 20 allowed). Consider refactoring.
Open

class RouteDocument implements RouteDocumentInterface
{
    /**
     * @var string $id
     *
Severity: Minor
Found in ModelBundle/Document/RouteDocument.php - About 5 hrs to fix

Node has 41 functions (exceeds 20 allowed). Consider refactoring.
Open

class Node implements NodeInterface
{
    use TimestampableDocument;
    use BlameableDocument;
    use Versionable;
Severity: Minor
Found in ModelBundle/Document/Node.php - About 5 hrs to fix

File ContentRepository.php has 377 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace OpenOrchestra\ModelBundle\Repository;

use Doctrine\Common\Collections\Collection;
Severity: Minor
Found in ModelBundle/Repository/ContentRepository.php - About 5 hrs to fix

ContentRepository has 37 functions (exceeds 20 allowed). Consider refactoring.
Open

class ContentRepository extends AbstractAggregateRepository implements FieldAutoGenerableRepositoryInterface, ContentRepositoryInterface, KeywordableTraitInterface
{
    use KeywordableTrait;
    use UseTrackableTrait;
    use FilterTrait;
Severity: Minor
Found in ModelBundle/Repository/ContentRepository.php - About 4 hrs to fix

FieldType has 30 functions (exceeds 20 allowed). Consider refactoring.
Open

class FieldType implements FieldTypeInterface
{
    /**
     * @var string $fieldId
     *
Severity: Minor
Found in ModelBundle/Document/FieldType.php - About 3 hrs to fix

Site has 27 functions (exceeds 20 allowed). Consider refactoring.
Open

class Site implements SiteInterface
{
    use Sitemapable;
    use SoftDeleteable;

Severity: Minor
Found in ModelBundle/Document/Site.php - About 3 hrs to fix

ContentType has 27 functions (exceeds 20 allowed). Consider refactoring.
Open

class ContentType implements ContentTypeInterface
{
    use BlameableDocument;
    use TimestampableDocument;
    use Versionable;
Severity: Minor
Found in ModelBundle/Document/ContentType.php - About 3 hrs to fix

AbstractStatus has 25 functions (exceeds 20 allowed). Consider refactoring.
Open

abstract class AbstractStatus implements StatusInterface
{
    /**
     * @var string $id
     *
Severity: Minor
Found in ModelBundle/Document/AbstractStatus.php - About 2 hrs to fix

Method generateGlobalBlock has 66 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function generateGlobalBlock(ObjectManager $manager, $language)
    {
        $siteBlockLogo = new Block();
        $siteBlockLogo->setLabel('Wysiwyg logo');
        $siteBlockLogo->setStyle('default');
Severity: Major
Found in ModelBundle/DataFixtures/MongoDB/LoadNodeRootFunctionalDemoData.php - About 2 hrs to fix

Block has 21 functions (exceeds 20 allowed). Consider refactoring.
Open

class Block implements BlockInterface
{
    use Cacheable;
    use TimestampableDocument;

Severity: Minor
Found in ModelBundle/Document/Block.php - About 2 hrs to fix

Function transformSubConditionToMongoCondition has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    public function transformSubConditionToMongoCondition($condition, array &$aliases)
    {
        $elements = array();
        $subElements = array();
        $operator = '$and';
Severity: Minor
Found in ModelBundle/Repository/RepositoryTrait/KeywordableTrait.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 preUpdate has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    public function preUpdate(LifecycleEventArgs $event)
    {
        if (!($object = $event->getDocument()) instanceof ContentInterface || in_array($object->getContentId(), $this->contentManaged)) {
            return;
        }

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 generateContentTypeCustomer has 46 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function generateContentTypeCustomer()
    {
        $maxLengthOption = $this->generateOption('max_length', 25);
        $required = $this->generateOption('required', true);

Severity: Minor
Found in ModelBundle/DataFixtures/MongoDB/LoadContentTypeData.php - About 1 hr to fix

Method generateContentTypeNews has 45 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function generateContentTypeNews()
    {
        $maxLengthOption = $this->generateOption('max_length', 25);
        $required = $this->generateOption('required', true);
        $dateWidgetOption = $this->generateOption('widget', 'single_text');
Severity: Minor
Found in ModelBundle/DataFixtures/MongoDB/LoadContentTypeData.php - About 1 hr to fix

Function process has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    public function process(ContainerBuilder $container)
    {
        $resourcePath = '.';

        foreach ($container->getResources() as $resource) {

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 execute has 38 lines of code (exceeds 25 allowed). Consider refactoring.
Open

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

        if (!is_null($input->getOption('type'))) {
            $type = $input->getOption('type');
Severity: Minor
Found in ModelBundle/Command/OrchestraLoadDataFixturesDoctrineODMCommand.php - About 1 hr to fix

Method provideDocumentClass has 37 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function provideDocumentClass()
    {
        return array(
            '1'  => array("empty", "OpenOrchestra\\ModelBundle\\Document\\Content"          , "content"           , "OpenOrchestra\\ModelBundle\\Repository\\ContentRepository"         , true),
            '2'  => array("empty", "OpenOrchestra\\ModelBundle\\Document\\ContentAttribute" , "content_attribute"                                                                             ),
Severity
Category
Status
Source
Language