open-orchestra/open-orchestra-model-bundle

View on GitHub

Showing 58 of 72 total issues

Method provideAnnotations has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function provideAnnotations()
    {
        $document0 = Phake::mock('OpenOrchestra\ModelInterface\Model\NodeInterface');
        Phake::when($document0)->getNodeId()->thenReturn(null);

Severity: Minor
Found in ModelBundle/Tests/EventListener/GenerateIdListenerTest.php - About 1 hr to fix

Function prePersist has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    public function prePersist(LifecycleEventArgs $event)
    {
        $document = $event->getDocument();
        $className = get_class($document);
        $generateAnnotations = $this->annotationReader->getClassAnnotation(new \ReflectionClass($className), 'OpenOrchestra\Mapping\Annotations\Document');
Severity: Minor
Found in ModelBundle/EventListener/GenerateIdListener.php - About 1 hr 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 loadStatus has 11 arguments (exceeds 4 allowed). Consider refactoring.
Open

        $enName,
        $frName,
        $name,
        $color,
        $publishedState = false,
Severity: Major
Found in ModelBundle/DataFixtures/MongoDB/AbstractLoadStatus.php - About 1 hr to fix

Method generateContentTypeCar has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function generateContentTypeCar()
    {
        $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 load has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function load(array $configs, ContainerBuilder $container)
    {
        $configuration = new Configuration();
        $config = $this->processConfiguration($configuration, $configs);

Severity: Minor
Found in ModelBundle/DependencyInjection/OpenOrchestraModelExtension.php - About 1 hr to fix

Method generateNodeGlobal has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function generateNodeGlobal($htmlContent, $language, $routePattern)
    {
        $nodeHomeBlock = new Block();
        $nodeHomeBlock->setLabel('Wysiwyg');
        $nodeHomeBlock->setLanguage($language);

Function load has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    public function load(array $configs, ContainerBuilder $container)
    {
        $configuration = new Configuration();
        $config = $this->processConfiguration($configuration, $configs);

Severity: Minor
Found in ModelBundle/DependencyInjection/OpenOrchestraModelExtension.php - About 1 hr 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 filterSearch has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    protected function filterSearch(PaginateFinderConfiguration $configuration, Stage $qa)
    {
        $siteName = $configuration->getSearchIndex('site_name');
        if (null !== $siteName && '' !== $siteName) {
            $qa->match(array('siteName' => new \MongoRegex('/.*' . $siteName . '.*/i')));
Severity: Minor
Found in ModelBundle/Repository/RedirectionRepository.php - About 1 hr 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 provideNodeForRecord has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function provideNodeForRecord()
    {
        $node0 = Phake::mock('OpenOrchestra\ModelBundle\Document\Node');
        Phake::when($node0)->getNodeId()->thenReturn('fakeId');
        Phake::when($node0)->getPath()->thenReturn('fakeParentPath/fakePastId');
Severity: Minor
Found in ModelBundle/Tests/EventListener/GeneratePathListenerTest.php - About 1 hr to fix

Method generateNodeFr has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function generateNodeFr()
    {
        $htmlContent = <<<EOF
<div class="contact-information">
    <h3>Contactez-nous</h3>

Method transformSubConditionToMongoCondition has 30 lines of code (exceeds 25 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 1 hr to fix

Method generateNodeFr has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function generateNodeFr()
    {
        $htmlContent = <<<EOF
<div class='content2'>
    <h1>Open-Orchestra</h1>

Method generateNodeDe has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function generateNodeDe()
    {
        $htmlContent = <<<EOF
<div class="contact-information">
    <h3>Kontaktieren Sie uns</h3>

Method findByAliasDomain has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function findByAliasDomain($domain)
    {
        $database = $this->dm->getDocumentDatabase($this->documentName);
        $collectionName = $this->dm->getClassMetadata($this->documentName)->collection;

Severity: Minor
Found in ModelBundle/Repository/SiteRepository.php - About 1 hr to fix

Method generateNodeEn has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function generateNodeEn()
    {
        $htmlContent = <<<EOF
<div class="contact-information">
    <h3>Contact Us</h3>

Method prePersist has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function prePersist(LifecycleEventArgs $event)
    {
        $document = $event->getDocument();
        $className = get_class($document);
        $generateAnnotations = $this->annotationReader->getClassAnnotation(new \ReflectionClass($className), 'OpenOrchestra\Mapping\Annotations\Document');
Severity: Minor
Found in ModelBundle/EventListener/GenerateIdListener.php - About 1 hr to fix

Function load has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function load(ObjectManager $objectManager)
    {
        for ($i = 0; $i < 250 ; $i++) {
            $objectManager->persist($this->generateNews($i, 1, 'fr'));
            // Versions
Severity: Minor
Found in ModelBundle/DataFixtures/MongoDB/LoadContentThousandData.php - About 1 hr 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 filterSearch has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    protected function filterSearch(PaginateFinderConfiguration $configuration, Stage $qa, $siteId)
    {
        $qa->match(array('siteId' => $siteId));

        $name = $configuration->getSearchIndex('name');
Severity: Minor
Found in ModelBundle/Repository/TrashItemRepository.php - About 1 hr 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 execute has a Cognitive Complexity of 10 (exceeds 5 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

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

    public function setPath(LifecycleEventArgs $eventArgs)
    {
        $document = $eventArgs->getDocument();
        if ($document instanceof NodeInterface && false === $document->isDeleted()) {
            $nodeRepository = $this->container->get('open_orchestra_model.repository.node');
Severity: Minor
Found in ModelBundle/EventListener/GeneratePathListener.php - About 1 hr to fix
Severity
Category
Status
Source
Language