Showing 72 of 72 total issues
Similar blocks of code found in 2 locations. Consider refactoring. Open
<?php
namespace OpenOrchestra\ModelBundle\DataFixtures\MongoDB\DemoContent;
use OpenOrchestra\ModelBundle\Document\Block;
- Read upRead up
- Create a ticketCreate a ticket
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 385.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
<?php
namespace OpenOrchestra\ModelBundle\DataFixtures\MongoDB\DemoContent;
use OpenOrchestra\ModelBundle\Document\Block;
- Read upRead up
- Create a ticketCreate a ticket
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 385.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
File NodeRepository.php
has 757 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace OpenOrchestra\ModelBundle\Repository;
use Doctrine\Common\Collections\Collection;
- Create a ticketCreate a ticket
NodeRepository
has 66 functions (exceeds 20 allowed). Consider refactoring. Open
class NodeRepository extends AbstractAggregateRepository implements FieldAutoGenerableRepositoryInterface, NodeRepositoryInterface
{
use AutoPublishableTrait;
use UseTrackableTrait;
use StatusableTrait;
- Create a ticketCreate a ticket
Similar blocks of code found in 2 locations. Consider refactoring. Open
protected function generateNodeGlobal($htmlContent, $name, $language, $routePattern)
{
$nodeAutoPublishBlock = new Block();
$nodeAutoPublishBlock->setLabel('Wysiwyg');
$nodeAutoPublishBlock->setLanguage($language);
- Read upRead up
- Create a ticketCreate a ticket
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 230.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
protected function generateNodeGlobal($htmlContent, $name, $language, $routePattern)
{
$nodeLegalBlock = new Block();
$nodeLegalBlock->setLabel('Wysiwyg');
$nodeLegalBlock->setLanguage($language);
- Read upRead up
- Create a ticketCreate a ticket
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 230.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
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');
- Create a ticketCreate a ticket
RouteDocument
has 41 functions (exceeds 20 allowed). Consider refactoring. Open
class RouteDocument implements RouteDocumentInterface
{
/**
* @var string $id
*
- Create a ticketCreate a ticket
Node
has 41 functions (exceeds 20 allowed). Consider refactoring. Open
class Node implements NodeInterface
{
use TimestampableDocument;
use BlameableDocument;
use Versionable;
- Create a ticketCreate a ticket
File ContentRepository.php
has 377 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace OpenOrchestra\ModelBundle\Repository;
use Doctrine\Common\Collections\Collection;
- Create a ticketCreate a ticket
ContentRepository
has 37 functions (exceeds 20 allowed). Consider refactoring. Open
class ContentRepository extends AbstractAggregateRepository implements FieldAutoGenerableRepositoryInterface, ContentRepositoryInterface, KeywordableTraitInterface
{
use KeywordableTrait;
use UseTrackableTrait;
use FilterTrait;
- Create a ticketCreate a ticket
FieldType
has 30 functions (exceeds 20 allowed). Consider refactoring. Open
class FieldType implements FieldTypeInterface
{
/**
* @var string $fieldId
*
- Create a ticketCreate a ticket
Site
has 27 functions (exceeds 20 allowed). Consider refactoring. Open
class Site implements SiteInterface
{
use Sitemapable;
use SoftDeleteable;
- Create a ticketCreate a ticket
ContentType
has 27 functions (exceeds 20 allowed). Consider refactoring. Open
class ContentType implements ContentTypeInterface
{
use BlameableDocument;
use TimestampableDocument;
use Versionable;
- Create a ticketCreate a ticket
AbstractStatus
has 25 functions (exceeds 20 allowed). Consider refactoring. Open
abstract class AbstractStatus implements StatusInterface
{
/**
* @var string $id
*
- Create a ticketCreate a ticket
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');
- Create a ticketCreate a ticket
Block
has 21 functions (exceeds 20 allowed). Consider refactoring. Open
class Block implements BlockInterface
{
use Cacheable;
use TimestampableDocument;
- Create a ticketCreate a ticket
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';
- Read upRead up
- Create a ticketCreate a ticket
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;
}
- Read upRead up
- Create a ticketCreate a ticket
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);
- Create a ticketCreate a ticket